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)
Scripted Data Set row not getting filled
apollowong
<p>I have created a BIRT report using scripted dataset to get data from a java class. The code seems to be able to get results but nomatter what I do I cannot get the dataset row to be filled. Here is my open script in dataset:</p><p> </p><p>open:</p><div>importPackage(Packages..javalib);</div><div> </div><div>data=new Data_ImpType();</div><div> </div><div>ev=data.GetSomething();</div><div> </div><div>and my fetch:</div><div> </div><div><div>row["EV01"]=ev[19];</div><div>row["EV02"]=ev[18];</div><div>row["EV03"]=ev[17];</div><div>row["EV04"]=ev[16];</div><div>row["EV05"]=ev[15];</div><div> </div><div>return(false);</div><div> </div><div>where the "EV01"... are the name of the column in my dataset. I can actually print out the contents of ev[] after the fetch, but the dataset table remains empty. </div><div> </div><div>BIRT did not complain about any error in the javascript. Would someone help....? Thanks ahead.</div><div> </div><div> </div></div><div> </div>
Find more posts tagged with
Comments
johnw
<p>Fetch should look something more like:</p><p> </p><p>Fetch:</p><pre class="_prettyXprint">if (ev != null){ row["EV01"]=ev[19]; row["EV02"]=ev[18]; row["EV03"]=ev[17]; row["EV04"]=ev[16]; row["EV05"]=ev[15]; return (true);}return (false);</pre><p>The fetch method has to return true if there is data, and false if there is nothing to return. In your case, your always forcing it to false, so BIRT doesn't think there is anything there.</p>
johnw
<p>Take a look at my <a data-ipb='nomediaparse' href='
http://www.birt-exchange.org/devshare/_/designing-birt-reports/birt-json-scripted-data-set-and-parameter-parsing-r1484'>JSON
example here</a>. In it, you can see how the Scripted Data Set returns true/false based on the presence of data, in the case of the example, if the index has exceeded the size of the JSON array.</p>
apollowong
<p>Great it works. You're the man. Thanks.</p>