How can I show the data of two local variables into one grid

I am using two local variables and the data is coming via expression rules (there are multiple columns)

local!empStatus: index(rule!EO_getEmpStatus(),"data",{}),
local!empDetail: index(rule!EO_getEmpDetail(),"data",{})

I want to use the data of local!empStatus and local!empDetail into single read-only grid.

  Discussion posts and replies are publicly visible

Parents
  • Hi

    You can try something similar to this

    load(
      
      local!empStatus: {{id:3,status:"Active"}, {id:2, status:"Active"}, {id:1, status: "Inactive"}},
      local!empDetail: {{id:1,name:"ABC"}, {id:2, name:"PQR"}, {id:3, name: "LMN"}},
    
    a!formLayout(
      label:"Form",
      contents:{
        a!gridField(
          label:"Employee",
          totalCount: 3,
          columns: {
            a!gridTextColumn(
              label:"Name",
              data:local!empDetail.name
            ),
            a!gridTextColumn(
              label:"Status",
              data:a!forEach(local!empDetail,index(local!empStatus.status, wherecontains(fv!item.id,local!empStatus.id)))
            )
          },
          value: a!pagingInfo(startIndex: 1, batchSize: -1),
          saveInto: {},
          identifiers:local!empDetail.id
        )
      }
    )
    )

    But, as suggested by Mike, you can append the cdts in a local variable and then use that data subset. This will avoid the overuse of the looping function

Reply
  • Hi

    You can try something similar to this

    load(
      
      local!empStatus: {{id:3,status:"Active"}, {id:2, status:"Active"}, {id:1, status: "Inactive"}},
      local!empDetail: {{id:1,name:"ABC"}, {id:2, name:"PQR"}, {id:3, name: "LMN"}},
    
    a!formLayout(
      label:"Form",
      contents:{
        a!gridField(
          label:"Employee",
          totalCount: 3,
          columns: {
            a!gridTextColumn(
              label:"Name",
              data:local!empDetail.name
            ),
            a!gridTextColumn(
              label:"Status",
              data:a!forEach(local!empDetail,index(local!empStatus.status, wherecontains(fv!item.id,local!empStatus.id)))
            )
          },
          value: a!pagingInfo(startIndex: 1, batchSize: -1),
          saveInto: {},
          identifiers:local!empDetail.id
        )
      }
    )
    )

    But, as suggested by Mike, you can append the cdts in a local variable and then use that data subset. This will avoid the overuse of the looping function

Children