Dim inputlist As List
Dim inlocation, repin, repout, pathrepout, reptype, driverclass, url As String
'
'Location of the * .report file and any necessary images
inlocation = File.DirApp & filesep & "reports" 'For this demo the report is stored in the Objects / reports directory. You can specify any other directory.
'name of report created by NextReports.
repin = "Users2.0" 'Report specified: Report_name.report - No need for the .report extension
'
'Path for Output file
pathrepout = "www \ template \ PDF \"
'Output file specification
repout = "MYOUTPUT" 'name of output report
reptype = "PDF" 'Available options: CSV, TXT, XLS, XML, PDF, HTML or RTF. File type must be in CAPITALS.
'Output file will be MYOUTPUT.RTF. Output file (and any necessary images) will be stored in your application directory
'logs the location of the report file
LogDebug ("Location =" & inlocation)
'replace this by your database driver class name
driverclass = "com.mysql.jdbc.Driver" 'driver class for Mysql
'
'replace this by applicable url for your database
'I use IP instead of server name. For some reason, in my tests with SQL SERVER, when I used server name, it would not work on MACs
'jdbc: mysql: // localhost: 3306 / HerongDB? user = Herong & password = TopSecret
url = "jdbc: mysql: // localhost / harris? user = root & password = usbw"
'DBM.InitializeMySQL ("jdbc: mysql: // localhost / harris? CharacterEncoding = utf8", "root", "usbw", 100)
'Initialize input list and add necessary arguments in the order shown below
inputlist.initialize
inputlist.Add (inlocation)
inputlist.add (repin)
inputlist.add (pathrepout & repout)
inputlist.add (reptype)
inputlist.add (driverclass)
inputlist.add (url)
'Now add your parameters - if any
'First, the parameter name - as it was defined in NextReports ie.
'add compare field in Report Designer $ {surname}
'Then add your parameter value - see examples below ...
'
'inputlist.add ("surname")
'inputlist.add ("xxxxx")
'
'for dates use date from DatePicker inputs on the B4j UI
'
'Dim t As Long
''
't = dpDateFrom.DateTicks
'inputlist.add ("start_date")
'inputlist.add (TicksToDate (t))
''
't = dpDateTo.DateTicks
'inputlist.add ("end_date")
'inputlist.add (TicksToDate (t))
'
'you can add as many parameters as necessary
'
Try
'Run the report and export the output report file
repexec.reportPrepAndRun (inputlist)
Catch
LogDebug ("Error: Loading Reports:" & LastException.Message)
End Try
'Show the output report file
Pdf.SetDocument (PdfPath & repout & "." & Reptype.ToLowerCase)
Pdf.Refresh