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)
ScriptedDataSource with JavaObject containing a List into Table/Grid
lumo
<p>What i have:</p>
<p> </p>
<p>i gain rows of <strong>Loan </strong>(Objects). each of it contain relations to <strong>LoanItem</strong>(s).</p>
<p>i do have access to those <strong>LoanItem</strong>(s) via</p>
<pre class="_prettyXprint">
row["loanItems"] // list of Java Objects</pre>
<p>i can also access the fields on (both Loan and LoanItem) it, all fine till here.</p>
<p> </p>
<p>What i try to do:</p>
<p>to define a <strong>Table </strong>or <strong>Grid </strong>with 4 <strong>Columns </strong>and defining the <strong>expressions </strong>how to fill each row with data from my List (of LoanItems), but did not find a way to do so.</p>
<div> </div>
<div>IFF this is possible, how?</div>
<div> </div>
<div>an dirty attempt was generating html and put this into a Text or Dynamic Text Report Item, but this does not look good and it does not really work out at all...</div>
<pre class="_prettyXprint _lang-js">
<value-of>
var items = row["loanItems"].size() + " items";
for (var index = 0; index < row["loanItems"].size(); index++) {
var loanItem = row["loanItems"].get(index);
items += (index==0) ? "\n<br>" : ",\n<br>";
if (loanItem.getObject()!=null){
items += loanItem.getObject().getId();
}
items += " | " + loanItem.getLoanPieces();
if (loanItem.getObject()!=null){
items += " | " + loanItem.getObject().getTaxon().getName();
}
// items += loanItem.getObject().getTaxon().getName();
}
// output items
items;
</value-of>
</pre>
<div>i hope this explanation is not too vague.</div>
<p> </p>
<p>Thanks in advance!</p>
Find more posts tagged with
Comments
sureshpulapalli
<p>I believe you are using Scripted dataset to access the java objects. Create columns on scripted data set and populate the values into it on Fetch() method and bind that dataset to your table.</p>
<p> </p>
<p>let me know if you need a sample</p>
lumo
<p>i already did that, but this is exactly where my problem arises!</p>
<p> </p>
<p>in my fetch method i fill</p>
<pre class="_prettyXprint">
row["loanItems"] // list</pre>
<p>but as this is a list of java objects... how can i bind that dataset to my table, so i can use it like every other column?</p>
sureshpulapalli
<p>can you create a sample and send it to me will have a look</p>
lumo
<p>first of all, thanks for your offer to help.</p>
<p> </p>
<p>but i dont know how to create a sample, as i am importing my own custom classes via imports, which i then use in the report.</p>
<p> </p>
<p>i try to follow this 'tutorial'</p>
<p><a data-ipb='nomediaparse' href='
https://wiki.eclipse.org/Nested_Tables_using_two_Scripted_data_sets_(BIRT)'>https://wiki.eclipse.org/Nested_Tables_using_two_Scripted_data_sets_(BIRT)</a></p>
;
<p> </p>
<p>or do you have an idea how/what i have to provide so you can use my java objects?</p>
<p> </p>
<p>i can post the report i have here, if this helps...</p>
sureshpulapalli
<p>I created a sample report, How I access the java objects.</p>
<p> </p>
<p>add the java classes .jar file to resources and using open and fetch method you can populate the rows.</p>
<p> </p>
<p>hope this helps.</p>
<p> </p>