Grid Field

Certified Associate Developer

I am querying a record to fetch two fields jurisdiction and lineofBusiness and displaying in a read only grid,Currently I am getting data like this

but I want to display only one row,which will have jurisdiction as 44 and all the three line of business in a single cell of column Line of Business

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Senior Developer
    in reply to mohiniv1048

    yes , you are not grouping it based on one field (with jurisdiction ref id). If you can do it during querying, it would be good or else i want you to create a map just like what i did in local!dataforGrid (Grouping based on Jurisdiction ref id ). and use it as source for your grid. I used Sample data just for the reference.

    a!localVariables(
      local!data: {
        a!map(
          jurisdictionrefid: 44,
          lineofBusinessDisplayName: "Bail Bond surity"
        ),
        a!map(
          jurisdictionrefid: 44,
          lineofBusinessDisplayName: "Credit Guarantee"
        ),
        a!map(
          jurisdictionrefid: 44,
          lineofBusinessDisplayName: "Legal Expense"
        ),
        a!map(
          jurisdictionrefid: 45,
          lineofBusinessDisplayName: "XYZ"
        ),
        a!map(
          jurisdictionrefid: 45,
          lineofBusinessDisplayName: "ABC"
        ),
        a!map(
          jurisdictionrefid: 46,
          lineofBusinessDisplayName: "PQR"
        )
      },
      local!dataforGrid:a!forEach(
       items:  union(local!data.jurisdictionrefid,local!data.jurisdictionrefid),
       expression: a!map(
         jurisdiction:fv!item,
         lineofBusiness:index(local!data.lineofBusinessDisplayName,wherecontains(fv!item,local!data.jurisdictionrefid))
       )
      ),
      a!gridField(
        data: local!dataforGrid,
        columns: {
          a!gridColumn(
          label:"jurisdiction",
          value: fv!row.jurisdiction
        ),
        a!gridColumn(
          label:"lineofBusiness",
          value: a!richTextDisplayField(
            value: a!richTextBulletedList(
              items: fv!row.lineofBusiness
            )
          )
        )
        }
      )
    )

Children