i have an requirement of optimising below query rule used inside grid column ..

i have an requirement of optimising below  grid column , in the value of grid Column  i am fetching the required value from query rule.But i have to declare query rule in local variable first and then i have to use 

how shud i fetch the relevant value after using in local variable .

a!gridColumn(
label: "Data Type",
value: index(
rule!WFM_qeGetLookupRefDataByInput(
isActive: true(),
lookupRefId: fv!row['recordType!FWM_record.id]
),
"label",
{}
)
)

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    1 month ago

    You will need to declare a local variable (say local!lookUpRefData) with value  rule!WFM_qeGetLookupRefDataByInput(isactive:true()). This rule should work as if when there is no lookupRefId passed, the output returns all the active ref Ids. 

    Then modify your gridColumn's value to index data from the local variable based on the record Id. E.g.

    index(
    index(
    local!lookUpRefData,
    wherecontains(fv!row['recordType!FWM_record.id],local!lookUpRefData.recordId),
    {}),
    "label",
    {}
    )

    Make use of appropriate columns names and you should have the correct data.

  • 0
    Certified Lead Developer
    1 month ago

    Based on Harsha's example, you can also use the displayvalue() function. It looks for a value in the first list, and returns the item from the second list at the same index.

    a!localVariables(
      local!data: {
        a!map(key: "one", value: "theOne"),
        a!map(key: "two", value: "theTwo"),
        a!map(key: "three", value: "theThree"),
      },
      displayvalue(
        "two",
        local!data.key,
        local!data.value,
        null
      )
    )