Skip to main content
natashan0002
May 22, 2021
Question

how to add another column to the array of dictionary retrieved queryEntity

  • May 22, 2021
  • 2 replies
  • 0 views

Hello,

I have a local variable which holds the data retrieved by the rule(queryEntity columns).

The columns retrieved are Col1, Col2. I want to add Col3 to this.

eg. local!QA[1]: [Id:243,value:"Question"]  these are the columns retrieved from the rule . I want to add column "Answer" to this.

There can be multiple rows. I tried getting the individual row using foreach(), but then idk how to add anothe column to the row.

how can i do it?

2 replies

ranjiths0003
May 22, 2021

Hi Natasha,

use the code below

a!localVariables(
  local!QA: {
    { Id: 234, value: "Question" },
    { Id: 235, value: "Question" }
  },
  a!flatten(a!forEach(
    local!QA,
    {
     {
        Id: fv!item.Id,
        value: fv!item.value,
        answer: " ANS"
      }
    }
  )
  )
)

natashan0002
May 22, 2021

Hello Ranjith,

It works!! Thank you [emoticon:c4563cd7d5574777a71c318021cbbcc8]