Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Unable to populate data to scripted dataset from normal dataset (classic dataset)
Srinivas Yarra
<p>Hi,</p>
<p> </p>
<p>I'm trying to populate classic dataset data to scripted dataset. But i am getting 17070 error message.</p>
<p> </p>
<p>in open :-</p>
<p> </p>
<div>importPackage(Packages.java.lang);</div>
<div>importPackage(Packages.org.eclipse.birt.report.data.adapter.api);</div>
<div>importPackage(Packages.org.eclipse.birt.report.model.api);</div>
<div>importPackage(Packages.org.eclipse.birt.data.engine.api.querydefn);</div>
<div> </div>
<div> </div>
<div>var config = reportContext.getReportRunnable().getReportEngine().getConfig();</div>
<div>var dataSource = reportContext.getDesignHandle().findDataSource("Classic_DS");</div>
<div>var dataSet = reportContext.getDesignHandle().findDataSet("C_DS");</div>
<div> </div>
<div>mySession = DataRequestSession.newSession(config, new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));</div>
<div>mySession.defineDataSource(mySession.getModelAdaptor().adaptDataSource(dataSource));</div>
<div>mySession.defineDataSet(mySession.getModelAdaptor().adaptDataSet(dataSet));</div>
<div> </div>
<div>queryDefinition = new QueryDefinition();</div>
<div>queryDefinition.setDataSetName(dataSet.name);</div>
<div>queryDefinition.setAutoBinding(true);</div>
<div> </div>
<div>var pq = mySession.prepare(queryDefinition);</div>
<div>query = pq.execute(null);</div>
<div>recordsIterator = query.getResultIterator();</div>
<div> </div>
<div>fetch :-</div>
<div> </div>
<div>
<div>if (recordsIterator.next()) {</div>
<div>row["CUSTOMERNAME"] = recordsIterator.getValue("CUSTOMERNAME");</div>
<div>row["CITY"] = recordsIterator.getValue("CITY");</div>
<div>return true;</div>
<div>}else {</div>
<div>return false;</div>
<div>}</div>
<div> </div>
<div> </div>
<div>What was wrong in my code? Please ping .rptdesign file in the attachments.</div>
<div> </div>
<div>How to debug or log console?</div>
<div> </div>
<div>Thanks,</div>
<div>Srinivas</div>
</div>
Find more posts tagged with
Comments
Clement Wong
<p>It looks like you are using commercial BIRT based on the .rptdesign; I see a ThemesReportItems31 reference. For future posts, I would recommend specifying the type (OS or commercial BIRT) and the version you are using.</p>
<p> </p>
<p>So this part of your code works in OS BIRT:</p>
<pre class="_prettyXprint">
queryDefinition = new QueryDefinition();
queryDefinition.setDataSetName(dataSet.name);
queryDefinition.setAutoBinding(true);</pre>
<p>But should be changed to the following in commercial BIRT:</p>
<pre class="_prettyXprint">
queryDefinition = new QueryDefinition(true);
queryDefinition.setDataSetName(dataSet.name);
//queryDefinition.setAutoBinding(true);</pre>
<p>To debug, you can use Eclipse Debug mode. Or you can log to the Eclipse "Error Log" tab where the Property Editor, Problems, Server Explorer, Properties, and Console are located at (default) the bottom of your Eclipse window.</p>
<p> </p>
<p>For commercial BIRT, you can use this:</p>
<pre class="_prettyXprint">
logger = java.util.logging.Logger.getLogger("birt.report.logger");
logger.warning ('your message here');
</pre>
Srinivas Yarra
<p>Thank you very much Clement Wong. It is working fine. How to get the total no of rows from IResultIterator class or any other api method?</p>