Hello, I have a local variable that contains an array of text retrieved from an API Call as seen below:
a!save(local!transactionList, { id: local!Transjsondata.GetTransInfo.TransInfo.Id, time: local!Transjsondata.GetTransInfo.TransInfo.Time, amount: local!Transjsondata.GetTransInfo.TransInfo.Amount, })
so let's assume for example that i have 5 items in my transactionlist, each with their own id, time and amount, how can I represent each item accordingly in a gridview in its own row? I tried the below implementation:
a!gridField( label: "List of Transactions", labelPosition: "ABOVE", data: local!transactionList, columns: { a!gridColumn( label: "Id", value: fv!row.id ), a!gridColumn( label: "Time", value: fv!row.time ) }, validations: {}, selectable: true ),
However the problem is instead of having one row for each transaction, I have only one row that stores all 5 transactions and all 5 times, how can iterate or maybe use a foreach statement in order to divide them into separate rows?
Discussion posts and replies are publicly visible
hi mohamedz4875 do you want to display, "ID", in one column and remaining, time and amount in the next column?
is it something like this ?
Could you try this code and let me know.
a!localVariables( local!data:{ a!map(id: 1, time: "Time test", amount:100), a!map(id:2, time: "Time test2", amount: 200), }, { a!gridField( label: "Read-only Grid", labelPosition: "ABOVE", data:local!data, columns: { a!gridColumn( label: "id", value: fv!row.id ), a!gridColumn( label: "Data", value: a!richTextDisplayField( value: { a!richTextItem( text: "time" ), concat(" ",":"," "), a!richTextItem( text: fv!row.time ), repeat(2,char(32)), concat(","," "), a!richTextItem( text: "amount" ), concat(" ",":"," "), a!richTextItem( text: fv!row.amount, ), repeat(2,char(32)) } ) ) }, validations: {} ) } )