BIRT JSON DATA IN LOOP
Hi All,
I have a requirement where I am getting JSON data and need to show it in table. JSON which as list within list
var i;
var j;
var k;
for (k = 0; k < myJSONObject.releasePackage.length; k++) {
for (i = 0; i < myJSONObject.releasePackage[k].paymentTerms.length; i++) {
for (j = 0; j < myJSONObject.releasePackage[k].paymentTerms[i].salesOrderItems.length; j++) {
}
}
}
How can I use it in fetch of scripted data source?
I need data as
col1 : release package id
col2 : payment term id
col3 : sales order item id
Number of records will be equal to sum of all sales order items in all payment terms in all release packages.
If any sample available, request you to share same.
Answers
-
In the inner "for" loop, you could add the following code:
row.col1 = myJSONObject.releasePackage[k]; row.col2 =myJSONObject.releasePackage[k].paymentTermse[i]; row.col3 = myJSONObject.releasePackage[k].paymentTerms[i].salesOrderItems[j];
This code is untested. Please test it with your data. Once you create the table, you can create groups on release package id and payment term id to avoid displaying many duplicate values.
Warning No formatter is installed for the format ipb1
Categories
- All Categories
- 109 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 122 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management