Skip to Content
0
Former Member
Oct 19, 2006 at 04:52 PM

How to programatically add a table?

28 Views

<p>Hi,</p><p>It would be very useful if I could programmatically create the table structures in my report files (rather than relying on the POJO drag & drop). Programmatically creating the tables at design time, combined with converting my POJOs to a resultset at runtime could help me workaround the lack of support for nested POJO properties. The idea here is that I wouldn&#39;t have to create special classes and special properties for every data source I want to have in a report and just make the whole thing more dynamic.</p><p>Anyway, here&#39;s a little test code snippet that I tried without success. I&#39;m wondering if anyone can point out where the problem might be. Thanks.</p><p>&nbsp;</p><p> ReportClientDocument reportClientDoc = new ReportClientDocument();<br /> reportClientDoc.setReportAppServer("inproc:jrc");<br /> reportClientDoc.open(REPORT_NAME, 1);</p><p>&nbsp;</p><p> Field f1 = new DBField();<br /> f1.setName("field1");<br /> f1.setType(FieldValueType.numberField);<br /> <br /> Fields fields = new Fields();<br /> fields.add(f1);<br /> <br /> Table table = new Table();<br /> table.setName("Table 1");<br /> table.setDataFields(fields);<br /> <br /> reportClientDoc.getDatabaseController().addTable(table, new TableLinks());<br /> <br /> reportClientDoc.save();<br /> System.out.println("Done!"); </p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>--


gives me this -

 

com.businessobjects.reports.sdk.JRCCommunicationAdapter: JRCAgent1 detected an exception: Invalid argument
at com.crystaldecisions.reports.reportdefinition.datainterface.k.case(Unknown Source)
at com.businessobjects.reports.sdk.b.w.a(Unknown Source)
at com.businessobjects.reports.sdk.b.w.int(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ag.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.bu.if(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.bu.void(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.a6.for(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.u.performDo(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.u.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.new(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.addTable(Unknown Source)
at test.ReportTest.launchApplication(ReportTest.java:58)
at test.ReportTest$1.run(ReportTest.java:79)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Invalid argument

-- Error code:-2147467259 Error code name:failed<br /> </p><p>&nbsp;</p>