Convert List of Text String to List

I have a local variable which is receiving BacthPayloadInput Response from process model

local!updatedPurchasers_at: index(
ri!EF_GeneralUpdatePayload_cdt.RequestJson,
wherecontains(
tostring("PowerPurchasers"),
cast(103, index(ri!EF_GeneralUpdatePayload_cdt,"RequestEndpoint",{}))
),
null
),

when i output the values it contains in expression rule it gives me output like this:

I want to extract the only "KeyPowerPurchasers" out of it which i am not able to do so.

I have been trying to get it in following these two methods but both are having problem:

first one:

local!purchaserKeys_int:reject(
fn!isnull,
{
if(
a!isNullOrEmpty(local!updatedPurchasers_at),
null,
cast(101, index(local!updatedPurchasers_at, "KeyPowerPurchasers", {}))
)
}
),

it gives empty array {}

2nd one:

  local!purchaserKeys_int:reject(
fn!isnull,
{
if(
a!isNullOrEmpty(local!updatedPurchasers_at),
null,
cast(101,a!fromJson(local!updatedPurchasers_at).KeyPowerPurchasers)
)
}
),

this gives 

Expression evaluation error at function a!fromJson : The jsonText parameter was not valid JSON.

can anyone please guide how can i get the list of KeyPowerPurchasers out of it only?

  Discussion posts and replies are publicly visible

Parents
  • You can also utilize the keval() function:

    a!localVariables(
      local!list: {
        "[KeyPowerPurchaser:-2147483254,ExpectedPowerPurchased: 123]",
        "[KeyPowerPurchaser:-2147483253,ExpectedPowerPurchased: 456]"
      },
      local!result: a!forEach(
        items: local!list,
        expression: keyval(
          local!list[fv!index],  /* text  */
          "KeyPowerPurchaser",   /* keys  */
          ":",                   /* separtors  */
          ","                    /* delimiters  */
        )
      ),
      a!flatten(local!result)
    )


    The result will be: 

Reply
  • You can also utilize the keval() function:

    a!localVariables(
      local!list: {
        "[KeyPowerPurchaser:-2147483254,ExpectedPowerPurchased: 123]",
        "[KeyPowerPurchaser:-2147483253,ExpectedPowerPurchased: 456]"
      },
      local!result: a!forEach(
        items: local!list,
        expression: keyval(
          local!list[fv!index],  /* text  */
          "KeyPowerPurchaser",   /* keys  */
          ":",                   /* separtors  */
          ","                    /* delimiters  */
        )
      ),
      a!flatten(local!result)
    )


    The result will be: 

Children
No Data