Fetching data in grid in below format

Certified Associate Developer

We have two variables as

local!legacyData {"OTHER", "Number Block Request", "OTHER", "CRIS3-AB", "CRIS3-AB", "CRIS3-AB", "CRIS3-AB", "CRIS3-AB"},

local!legacyOrderValue {"JADE844610514", "76944", "SR-01028013", "I4166196233", "I3433620146", "I3433570105", "I6139550170", "I3432220101"}

As of now we are getting data in below format

But we want to display data in below format

  Discussion posts and replies are publicly visible

  • 0
    Certified Senior Developer

    If the issue is about merging order numbers when the system is the same then you can use the following code: 

    a!localVariables(
      local!legacyData: {"OTHER", "Number Block Request", "OTHER", "CRIS3-AB", "CRIS3-AB", "CRIS3-AB", "CRIS3-AB", "CRIS3-AB"},
      local!legacyOrderValue: {"JADE844610514", "76944", "SR-01028013", "I4166196233", "I3433620146", "I3433570105", "I6139550170", "I3432220101"},
      /*FIND THE UNIQUE DATA KEYS*/
      local!uniqueData: union(local!legacyData, local!legacyData),
      /*FIND THE VALUES ASSOCIATED WITH EACH UNIQUE NAME*/
      local!data: a!forEach(
        items: local!uniqueData,
        expression: a!localVariables(
          local!indices: wherecontains(fv!item, local!legacyData),
          a!map(
            data: fv!item,
            orderValue: index(local!legacyOrderValue, local!indices, null)
          )
        )
      ),
      {
        a!gridField(
          label: "Legacy Order",
          labelPosition: "ABOVE",
          data: local!data,
          columns: {
            a!gridColumn(
              label: "System",
              value: index(fv!row, "data", null)
            ),
            a!gridColumn(
              label: "Order Number",
              value: joinarray(index(fv!row, "orderValue", null), char(10)))
          },
          validations: {}
        )
      }
    )

    For the ways you can display the order number column you could play around with the a!richtextDisplayField() options.