B4J Question [Solved] Next Report 9.1 problem with file

magi6162

Well-Known Member
Licensed User
I have created a report with a subreport.
In the Next Report Designer 9.1 everything is OK.
When I go to run:
nr.reportPrepAndRun (inputlist) (see Attachment)
I get an error. The report file exists and the file path is correct)
I use ABM 4.03 and B4J 6.0
B4X:
                    Dim os As String = GetSystemProperty("os.name", "").ToLowerCase
                    Dim filesep As String
                    If os.Contains("win") Then
                        filesep="\"
                    Else
                        filesep="/"
                    End If
                    Dim orig As String = "www" & filesep & ABMShared.AppName & filesep

                    Private reportparams As Map
                    Dim nr As jNxtReportsB4J
                    Dim jdbcUrl As String
                    jdbcUrl = ABMShared.MySQLConnectionString("localhost","3306","jwval_org")
 
                    Dim orig As String = "www" & filesep & ABMShared.AppName & filesep
                    reportparams.Initialize
                    reportparams.Put("ReportFolder" , File.DirApp & filesep & orig & "reports"                    )
                    reportparams.Put("ReportName"   , "cartolina"                                                 )
                    reportparams.Put("ReportOutName", File.DirApp & filesep & orig & "pdf" & filesep & "cartolina")
                    reportparams.Put("ReportOutType", "PDF"                                                       )
                    reportparams.Put("DriverClassDB", "com.mysql.jdbc.Driver"                                     )
                    reportparams.Put("UrlDB"        , jdbcUrl & "?useSSL=false&user=xxxxx&password=xxxxx"       )
 
                    Dim inputlist As List
                    inputlist.initialize
                    inputlist.Add(reportparams.Get("ReportFolder" ))
                    inputlist.add(reportparams.Get("ReportName"   ))
                    inputlist.add(reportparams.Get("ReportOutName"))
                    inputlist.add(reportparams.Get("ReportOutType"))
                    inputlist.add(reportparams.Get("DriverClassDB"))
                    inputlist.add(reportparams.Get("UrlDB"        ))

                    'Carico i parametri del report
                    inputlist.add("IDP")
                    inputlist.Add(IDPReportCartolina)
 
                    inputlist.Add("Anno")
                    inputlist.Add(result)
 
                    ' eseguo il report e creo il file pdf
                    nr.reportPrepAndRun(inputlist)  <<<<---- ERROR

Error:
Viewer running on os: windows 10
Trying to open: C:\PROGET~1\JWVAL\Objects/viewer.html
Connected
Waiting for value (100 ms)
Waiting for value (101 ms)
Waiting for value (100 ms)
Waiting for value (100 ms)
Connected
Waiting for value (100 ms)
Waiting for value (100 ms)
Waiting for value (100 ms)
Waiting for value (100 ms)
Connected
Waiting for value (100 ms)
Waiting for value (101 ms)
Waiting for value (100 ms)
Waiting for value (100 ms)
Connected
Waiting for value (100 ms)
Waiting for value (100 ms)
Waiting for value (100 ms)
Waiting for value (101 ms)
Waiting for value (100 ms)
Disconnected
Connected
Waiting for value (100 ms)
Saving the first instance
Waiting for value (100 ms)
Websocket first connection
Waiting for value (1952 ms)
JWVALHome9c246040-89f6-434b-bbc4-bea00e051c36
Disconnected
Connected
Waiting for value (100 ms)
Saving the first instance
Waiting for value (100 ms)
Websocket first connection
Waiting for value (100 ms)
width in PX: 1600
height in PX: 998
screen width: 2
Waiting for value (100 ms)
Waiting for value (100 ms)
Waiting for value (100 ms)
Waiting for value (100 ms)
Waiting for value (168 ms)
Waiting for value (100 ms)
ListaProclamatori9c246040-89f6-434b-bbc4-bea00e051c36
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: Oracle = ro.nextreports.engine.querybuilder.sql.dialect.OracleDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: Adaptive Server Anywhere = ro.nextreports.engine.querybuilder.sql.dialect.MSSQLDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: Microsoft SQL Server = ro.nextreports.engine.querybuilder.sql.dialect.MSSQLDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: MySQL = ro.nextreports.engine.querybuilder.sql.dialect.MySQLDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: Apache Derby = ro.nextreports.engine.querybuilder.sql.dialect.DerbyDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: PostgreSQL = ro.nextreports.engine.querybuilder.sql.dialect.PostrgreSQLDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: SQLite = ro.nextreports.engine.querybuilder.sql.dialect.SQLiteDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: CsvJdbc = ro.nextreports.engine.querybuilder.sql.dialect.CSVDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: Vertica Database = ro.nextreports.engine.querybuilder.sql.dialect.VerticaDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: Pervasive.SQL = ro.nextreports.engine.querybuilder.sql.dialect.PervasiveDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: Teradata = ro.nextreports.engine.querybuilder.sql.dialect.TeradataDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.DialectFactory addDialect
INFORMAZIONI: Dialect added: Ucanaccess = ro.nextreports.engine.querybuilder.sql.dialect.MSAccessDialect
dic 21, 2017 8:54:53 AM ro.nextreports.engine.querybuilder.sql.dialect.AbstractDialect <init>
INFORMAZIONI: Using dialect: ro.nextreports.engine.querybuilder.sql.dialect.MySQLDialect@f0da945
java.io.FileNotFoundException:
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
at ro.nextreports.integration.ReportExec.runReport(ReportExec.java:61)
at ro.nextreports.integration.ReportExec.reportPrepAndRun(ReportExec.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:657)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:482)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:445)
at mc.jw.jwval.listaproclamatori._page_parseevent(listaproclamatori.java:3255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:613)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:231)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4j.object.WebSocketModule$Adapter$1.run(WebSocketModule.java:126)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4a.ShellBA.startMessageLoop(ShellBA.java:114)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:148)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:303)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4j.object.JServlet.createInstance(JServlet.java:65)
at anywheresoftware.b4j.object.BackgroundWorkersManager$1.run(BackgroundWorkersManager.java:21)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4a.ShellBA.startMessageLoop(ShellBA.java:114)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:148)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:303)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at mc.jw.jwval.main.main(main.java:29)
 

Attachments

  • Cattura13.PNG
    Cattura13.PNG
    6.8 KB · Views: 165
Last edited:

magi6162

Well-Known Member
Licensed User
Ok,
executed in Release mode.
Now create the pdf file, but when I go to see it using this code:
B4X:
                    ' eseguo il report e creo il file pdf
                    nr.reportPrepAndRun(inputlist)
                    Log("Visiona pdf")
                    Dim pdfC As ABMPDFViewer = page.Component("pdfC")
                    pdfC.SetDocument(NomePDFReport)
                    Log("Visiona 1 pdf")
                    pdfC.Refresh
                    page.Resume
the ABMPDFViewer component appears, but empty without the file I wanted.
The file path is correct and the file is created correctly. (I display it with Acrobat reader):(
There are no errors in the log.
 

Attachments

  • Cattura14.PNG
    Cattura14.PNG
    8.8 KB · Views: 154
Last edited:
Upvote 0

Harris

Expert
Licensed User
What is: NomePDFReport?

Also, you may want to Sleep(2000) after nr.reportPrepAndRun(inputlist) to give the report time to build and commit the file to disk.

B4X:
Sub ShowInspDoc(fName As String)

If File.Exists(Main.inspectFolder,fName) Then ' folder where pdf stored and file.pdf...
     Dim pdf1 As ABMPDFViewer    = page.Component("pdf")
     pdf1.SetDocument( "../inspects/"&fName) ' path relative to app
     Log("  selected: "&"../inspects/"&fName)
     pdf1.Refresh
Else
    Toast(" No File Found ",3000)
End If

End Sub
 
Upvote 0
Top