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)
Nested Loop In birt
vartika
Here is my code in script.
Table is getting populated with last value in the list irrespective of list size.But the print statement inside the list printing all the values in list.
if(count==0)
{
Packages.java.lang.System.out.println("row[clientName]:"+summaryData.getTotalBilledHours()+"projectName:"+summaryData.getProjectName())
row["clientName"]=summaryData.getClientName();
row["projectName"]=summaryData.getProjectName();
row["startDate"]=summaryData.getStartDate();
row["endDate"]=summaryData.getEndDate();
row["totalSOWHours"]=summaryData.getTotalSOWHours();
row["projectTotalBilledHours"]=summaryData.getTotalBilledHours();
row["projectTotalAllocatedHours"]=summaryData.getTotalAlocatedHours();
row["projectRemaainingTotalHours"]=summaryData.getRemainingAllocatedHours();
for ( i=0; i<list.size(); i++ )
{
row["resourceName"] = list.get(i).getResourceName();
row["totalAllocatedHours"] = list.get(i).getTotalAllcatedHours();
row["totalBilledHours"] = list.get(i).getTotalBilledHours();
row["unusedAllocatedHours"] = list.get(i).getUnusedAllocatedHours();
Packages.java.lang.System.out.println("i=="+i+":"+row["resourceName"]+"--"+row["totalAllocatedHours"]+"--"+row["totalBilledHours"]+"--"+row["unusedAllocatedHours"])
}
count++;
return true;
}
return false;
Thanks in Advance, if anybody helps me to get rid of issue.
Thanks,
Vartika
Find more posts tagged with
Comments
JasonW
Where do you have this code? Note that if this in a scripted data set you do not loop it. The framework will automatically keep calling your fetch method until you return false;
For exmaple in an open script I could put:
i=0;
Then in a fetch
if( i > 4 ) return false;
row["testcol"]=" i;
i++;
return true;
The framework will continue to call my fetch method until it returns false.
Jason
vartika
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="108482" data-time="1344887342" data-date="13 August 2012 - 12:49 PM"><p>
Where do you have this code? Note that if this in a scripted data set you do not loop it. The framework will automatically keep calling your fetch method until you return false;<br />
<br />
For exmaple in an open script I could put:<br />
<br />
i=0;<br />
<br />
Then in a fetch<br />
<br />
if( i > 4 ) return false;<br />
row["testcol"]=" i;<br />
i++;<br />
return true;<br />
<br />
The framework will continue to call my fetch method until it returns false.<br />
<br />
Jason<br /></p></blockquote>
<br />
Thanks Jason for the reply.Here is my query <br />
<br />
If I have a list of company object and each company object is having a list of employee object so how should I iterate through each list so that I could display the result in this format <br />
<br />
Company1 Employee1<br />
Employee2<br />
Company2 Employee1<br />
Employee2<br />
<br />
I am using scripted data source.
vartika
Thanks Jason for the reply.But I have nested list.Here is my query
If I have a list of company object and each company object is having a list of employee object so how should I iterate through each list so that I could display the result in this format
Company1 Employee1
...........Employee2
Company2 Employee1
............Employee2
I am using scripted data source.
JasonW
How do you want your rows to come out?
String String String
Cmp1 Emply1 Emply2
??
Jason
JasonW
BTW generally nested objects are handled by multiple scripted data sets. Take a look at the attached example.
Jason