Sub Reporting(Reportname As String)
'File separator character is set, according to the OS detected.
Dim inputlist As List
Dim inlocation,repin, repout, reptype, driverclass, url As String
'
inlocation=iniBD & "\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=Reportname ' Report specified: Report_name.report - No need for the .report extension
'Output file specification
repout=Reportname '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
Log("Location = " & inlocation)
'replace this by your database driver class name
driverclass="com.sqlite.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 not work on MACs
'jdbc:mysql://localhost:3306/HerongDB?user=Herong&password=TopSecret
'url="jdbc:sqlite://127.0.0.1:3306/database_name?user=db_user&password=user_pw"
url="jdbc:sqlite://127.0.0.1:3306/database_name=database?user=&password="
'Initialize input list and add necessary arguments in the order shown below
inputlist.initialize
inputlist.Add(inlocation)
inputlist.add(repin)
inputlist.add(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 dates 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
report.reportPrepAndRun(inputlist)
Catch
Log("Error: Loading Reports : " & LastException.Message)
End Try
fx.ShowExternalDocument(File.GetUri(File.DIRAPP, repout & "." & reptype))
'
End Sub