Retrieve data in batches for rule input "list of Map"

Certified Associate Developer

Example:  Rule input has no. of items 24, I want to retrieve in batches of 10. i.e at 1st I need to get top 10, 2nd time next 10 items and 3rd time should get 4 items

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi check out the below code I have used data subset and paging Info.

    todatasubset(
      {
        { item: "Item 1", qty: 1, unitPrice: 10 },
        { item: "Item 2", qty: 2, unitPrice: 20 },
        { item: "Item 3", qty: 1, unitPrice: 10 },
        { item: "Item 4", qty: 2, unitPrice: 20 },
        { item: "Item 5", qty: 1, unitPrice: 10 },
        { item: "Item 6", qty: 2, unitPrice: 20 },
        { item: "Item 7", qty: 1, unitPrice: 10 },
        { item: "Item 8", qty: 2, unitPrice: 20 }
      },
      a!pagingInfo(startIndex: 2, batchSize: 3)
    ),

    EDIT 

    Here is example for read-only grid

    a!localVariables(
      local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 2),
      local!data: todatasubset(
        {
          { item: "Item 1", qty: 1, unitPrice: 10 },
          { item: "Item 2", qty: 2, unitPrice: 20 },
          { item: "Item 3", qty: 1, unitPrice: 10 },
          { item: "Item 4", qty: 2, unitPrice: 20 },
          { item: "Item 5", qty: 1, unitPrice: 10 },
          { item: "Item 6", qty: 2, unitPrice: 20 },
          { item: "Item 7", qty: 1, unitPrice: 10 },
          { item: "Item 8", qty: 2, unitPrice: 20 }
        },
        local!pagingInfo
      ),
      a!gridField(
        data: local!data,
        columns: {
          a!gridColumn(label: "Item", value: fv!row.item),
          a!gridColumn(label: "Quantity", value: fv!row.qty)
        },
        pagingSaveInto: local!pagingInfo
      )
    )
     

  • 0
    Certified Associate Developer
    in reply to ujjwalrathore

    Thank you I tried with todatasubset it worked :)

Reply Children
No Data