I'm facing an issue with printing JSON values from a database column in my Birt report. It seems to only display the last line of the JSON array, rather than all the lines before it.
Below is the code for my dynamic text field:
var phone = JSON.parse(row["c_numbers"]);
for(var k in phone) {
phone[k]['type']+': '+phone[k]['phone']
}
This is the output currently displayed:
https://i.sstatic.net/MDSEc.png
And here is the JSON data retrieved from the database:
[{"type": "Cell", "phone": "123-123-1233"}, {"type": "", "phone": "123-423-4123"}]
While I am able to fetch and iterate over the JSON data successfully, the report design only shows the last item in the array. Any suggestions on resolving this issue would be greatly appreciated.
https://i.sstatic.net/70Zg5.png
It seems like the script is fetching the data correctly, looping through the JSON array, but only displaying the final element.