Hi Team,
I want to display the single row of array data into multiple rows in read only grid. pls find the below screenshot.
one invoice reference number multiple order items in database, but i want to display one invc numer and one order item 1 row. Again, same invc number second value vale of order item number 2 different row. pls refers first row data.
Thanks,
Nagesh
Discussion posts and replies are publicly visible
Hello Unnam Nageswara Rao
below is something that will help you to understand how to achieve your requirement. Please replace with your values and fields accordingly to try out.
a!localVariables( local!data:yourDataHere, local!formatData: a!flatten( a!forEach( items: local!data, expression: a!localVariables( local!rowData: fv!item, a!forEach( items: fv!item.itemId, expression: a!map( invoice: local!rowData.invoice, itemId: fv!item, billedQuantity: index( local!rowData.billedQuantity, wherecontains(fv!item, local!rowData.itemId), null ) ) ) ) ) ), { a!gridField( label: "Original Data", data: local!data, columns: { a!gridColumn(label: "Invoice", value: fv!row.invoice), a!gridColumn(label: "Item Id", value: fv!row.itemId), a!gridColumn( label: "Billed Quantity", value: fv!row.billedQuantity ) } ), a!gridField( label: "Formatted Data", data: local!formatData, columns: { a!gridColumn(label: "Invoice", value: fv!row.invoice), a!gridColumn(label: "Item Id", value: fv!row.itemId), a!gridColumn( label: "Billed Quantity", value: fv!row.billedQuantity ) } ) } )
Also I would say, the way you are saving your data is not a preferable format. This would cause you troubles when displaying the data or while trying to update the data.I would suggest iterate each item before you save and have a new row of data with same invoice number.
local!data:yourDataHere, can i pass record type here
Yes you can. When you are passing your Record Type, In the local!formatData please index your values using recordType field references.
how to use index, some examples pls
Here is something from the documentation
Indexing recordType Values
recordtype!recordname.fields.fieldsname
index(index(local!recorddata,record!recordname.field,null),1,null)
Record Reference