Hi,
We have array of elements as Column data. with those we need to create todatasubset.
Example like I have 4 Array of elements like each
CustomerName Array,
ProductName Array,
Qty Array,
Price Array.
Please let me know how to create with these elements into data subset to use it in paging grid.
Thanks in advance.
Discussion posts and replies are publicly visible
Adding some little changes:
load( local!custArray: touniformstring( "aaa", "bbb", "ccc" ), local!prodNmArray: { "ddd", "eee", "ggg" }, local!qtyArray: { 10, null, 30 }, local!priceArray: { 40, 50, 60 }, local!array: a!forEach( items: local!custArray, expression: { customerName: index(local!custArray, fv!index, null), productName: index(local!prodNmArray, fv!index, null), quantity: index(local!qtyArray, fv!index, null), price: index(local!priceArray, fv!index, null) } ), local!finalData: todatasubset( local!array, topaginginfo( 1, - 1 ) ), a!formLayout( label: "Test Data", contents: { a!gridField( label: "Test", totalCount: local!finalData.totalCount, columns: { a!gridTextColumn( label: "Customer", data: index( local!finalData.data, "customerName", null ) ), a!gridTextColumn( label: "Product Name", data: index( local!finalData.data, "productName", null ) ), a!gridTextColumn( label: "Quantity", data: index( local!finalData.data, "quantity", null ) ), a!gridTextColumn( label: "Price", data: index( local!finalData.data, "price", null ) ) }, value: a!pagingInfo( 1, - 1 ) ) } ) )
Hope it solves your issue
Thanks for the working solution. here is the little updated version by enabling the selection to get the selected row indexes.
load( local!custArray: touniformstring( "aaa", "bbb", "ccc" ), local!prodNmArray: { "ddd", "eee", "ggg" }, local!qtyArray: { 10, null, 30 }, local!priceArray: { 40, 50, 60 }, local!array: a!forEach( items: local!custArray, expression: { customerName: index(local!custArray, fv!index, null), productName: index(local!prodNmArray, fv!index, null), quantity: index(local!qtyArray, fv!index, null), price: index(local!priceArray, fv!index, null) } ), local!gridSelection:a!gridSelection( pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 10 ) ), local!finalData: todatasubset( local!array, topaginginfo( 1, - 1 ) ), a!formLayout( label: "Test Data" & local!gridSelection.selected, contents: { a!gridField( label: "Test", totalCount: local!finalData.totalCount, columns: { a!gridTextColumn( label: "Customer", data: index( local!finalData.data, "customerName", null ) ), a!gridTextColumn( label: "Product Name", data: index( local!finalData.data, "productName", null ) ), a!gridTextColumn( label: "Quantity", data: index( local!finalData.data, "quantity", null ) ), a!gridTextColumn( label: "Price", data: index( local!finalData.data, "price", null ) ) }, value: local!gridSelection, saveInto: a!save(target:local!gridSelection,value:save!value), identifiers: local!finalData.identifiers, selection: true ) } ))
Thanks a lot. its solved my requirements