Using JSAPI to read data from BIRT report
<p>I have a report with 3 parameters. I need to create a script that reads data from this report and stores it in database. The script be scheduled to run as a Windows job. I get no errors but the code does not reach dispalyData(rs)</p>
<p> </p>
<div>function getResultset( )</div>
<div>{</div>
<div>actuate.authenticate</div>
<div> ("<a class="bbc_url" href="http://xxxxx:8700/iportal",null,"username","password">http://xxxxx:8700/iportal" ,</a> null, "username", "password", null, getResultset1, errorHandler);</div>
<div>}</div>
<div> </div>
<div>function getResultset1( )</div>
<div>{</div>
<div>file = "/xxxxx/xxxxxx/xxxxx/xxxxxxxxxxxx.rptdocument";</div>
<div>var requestOpts = new actuate.RequestOptions( );</div>
<div>requestOpts.setRepositoryType(actuate.RequestOptions.REPOSITORY_ENCYCLOPEDIA );</div>
<div>requestOpts.setCustomParameters({PIYearParam: "2016",PIMonthParam: "7",DayType: "1"});</div>
<div>var dataservice = new actuate.DataService();</div>
<div>dataservice.setService("<a class="bbc_url" href="http://xxxxx:8700/iportal",requestOpts">http://xxxxx:8700/iportal",requestOpts</a>);<span> </span></div>
<div>var request = new actuate.data.Request("bookmarkName",1,100);</div>
<div>dataservice.downloadResultSet(file, request, displayData, errorHandler);</div>
<div>alert("At the end.");</div>
<div>}</div>
<div> </div>
<div>function displayData(rs)</div>
<div>{</div>
<div>alert("In Display Data");</div>
<div>var columns = rs.getColumnNames( );</div>
<div>while (rs.next( )){</div>
<div>for (var i = 0; i < columns.length; i++){</div>
<div>document.writeln(rs.getValue(columns));</div>
<div>}</div>
<div>}</div>
<div>}</div>
<div> </div>
<div>function errorHandler(exception)</div>
<div>{</div>
<div>alert("Your application encountered an exception: \n" +<span> </span>exception.getMessage());</div>
<div>}</div>
<p> </p>
<div>function getResultset( )</div>
<div>{</div>
<div>actuate.authenticate</div>
<div> ("<a class="bbc_url" href="http://xxxxx:8700/iportal",null,"username","password">http://xxxxx:8700/iportal" ,</a> null, "username", "password", null, getResultset1, errorHandler);</div>
<div>}</div>
<div> </div>
<div>function getResultset1( )</div>
<div>{</div>
<div>file = "/xxxxx/xxxxxx/xxxxx/xxxxxxxxxxxx.rptdocument";</div>
<div>var requestOpts = new actuate.RequestOptions( );</div>
<div>requestOpts.setRepositoryType(actuate.RequestOptions.REPOSITORY_ENCYCLOPEDIA );</div>
<div>requestOpts.setCustomParameters({PIYearParam: "2016",PIMonthParam: "7",DayType: "1"});</div>
<div>var dataservice = new actuate.DataService();</div>
<div>dataservice.setService("<a class="bbc_url" href="http://xxxxx:8700/iportal",requestOpts">http://xxxxx:8700/iportal",requestOpts</a>);<span> </span></div>
<div>var request = new actuate.data.Request("bookmarkName",1,100);</div>
<div>dataservice.downloadResultSet(file, request, displayData, errorHandler);</div>
<div>alert("At the end.");</div>
<div>}</div>
<div> </div>
<div>function displayData(rs)</div>
<div>{</div>
<div>alert("In Display Data");</div>
<div>var columns = rs.getColumnNames( );</div>
<div>while (rs.next( )){</div>
<div>for (var i = 0; i < columns.length; i++){</div>
<div>document.writeln(rs.getValue(columns));</div>
<div>}</div>
<div>}</div>
<div>}</div>
<div> </div>
<div>function errorHandler(exception)</div>
<div>{</div>
<div>alert("Your application encountered an exception: \n" +<span> </span>exception.getMessage());</div>
<div>}</div>
0
Comments
-
<p>You won't be able to pass parameters into a .RPTDOCUMENT because the report has already been generated with the parameters previously specified to generate the report. </p>
<p> </p>
<p>What's the ultimate goal other than "I need to create a script that reads data from this report and stores it in database."</p>
<p> </p>
<p>You can add code into your report design that writes to the database.</p>
<p> </p>
<p>If you have specific parameters, you'll first need to run a .RPTDESIGN and then with the .RPTDOCUMENT extract the data.</p>
<p> </p>
<p>The REST API also provides this service and allows you to extract data from a materialized Data Object (.DATA) via /dataobject/dataExtraction.</p>
Warning No formatter is installed for the format ipb0 -
<p>Thanks Clement for your help.</p>
<p> </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">You won't be able to pass parameters into a .RPTDOCUMENT because the report has already been generated with the parameters previously specified to generate the report</span></p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">--> This makes it clear why I cannot use dataservice object to extract data from a report that has parameters and all do not have default values.</span></p>
<p> </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">You can add code into your report design that writes to the database</span></p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">-->I don't have access to or control over report design</span></p>
<p> </p>
<p>My ultimate goal:</p>
<p>I have to create something in .net that reads data from a parameterised BIRT report and writes it to an Oracle table. This something should be scheduled to run automatically few times a month. </p>
0 -
<p>One option:</p>
<p>In the iHub, you can schedule the .RPTDESIGN to generate the .RPTDOCUMENT.</p>
<p> </p>
<p>Then, you can schedule your .NET app to read from the the .RPTDOCUMENT to write to the Oracle table.</p>
<p> </p>
<p> </p>
<p>Another option as suggested previously.</p>
<p>Add logic into your .RPTDESIGN to write to the Oracle table. In the iHub, schedule the .RPTDESIGN as needed.</p>
Warning No formatter is installed for the format ipb0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 144 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management