To display the single row array data into multiple rows in Read-only grid.

Certified Associate Developer

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

Parents
  • 0
    Certified Senior Developer

    Data Source: Make sure your grid's data source is set to the list containing the invoice data. Each element in the list should have an "invoiceReference" property and an "orderItems" array property containing the order item details.

    Looping Expression: Create a new expression rule and set the output data type to "List of Dictionary". Use a looping expression to iterate through the "orderItems" array within each element of the data source list. Here's an example expression:

    forEach(invoice in data_source,
    forOrder in invoice.orderItems, {
    "invoiceReference": invoice.invoiceReference,
    "orderItem": forOrder
    }
    )


    This expression iterates through each invoice in the data source and each order item within that invoice. It then creates a new dictionary for each order item, containing the "invoiceReference" and the current "orderItem" value.

    Grid Configuration: Set the grid's data source to the output of the looping expression rule. Define two columns in the grid:
    Label: "Invoice Reference"
    Value: currentRow.invoiceReference
    Label: "Order Item"
    Value: currentRow.orderItem

Reply
  • 0
    Certified Senior Developer

    Data Source: Make sure your grid's data source is set to the list containing the invoice data. Each element in the list should have an "invoiceReference" property and an "orderItems" array property containing the order item details.

    Looping Expression: Create a new expression rule and set the output data type to "List of Dictionary". Use a looping expression to iterate through the "orderItems" array within each element of the data source list. Here's an example expression:

    forEach(invoice in data_source,
    forOrder in invoice.orderItems, {
    "invoiceReference": invoice.invoiceReference,
    "orderItem": forOrder
    }
    )


    This expression iterates through each invoice in the data source and each order item within that invoice. It then creates a new dictionary for each order item, containing the "invoiceReference" and the current "orderItem" value.

    Grid Configuration: Set the grid's data source to the output of the looping expression rule. Define two columns in the grid:
    Label: "Invoice Reference"
    Value: currentRow.invoiceReference
    Label: "Order Item"
    Value: currentRow.orderItem

Children
No Data