Skip to main content
faraza4154
September 29, 2022
Question

Adding new key values in list of dictionary in all rows

  • September 29, 2022
  • 2 replies
  • 0 views

I have a list of dictionary with 3 Keys in it I want to add a new Key:Value in all the rows so there will be 4 keys after that.

2 replies

Participating Frequently
September 29, 2022

Hi, you can use the map function for this. We don't have any direct way of doing that we have to apply loop  to create a custom map and then use it.

https://docs.appian.com/suite/help/22.3/fnc_system_map.html

a!localVariables(
  local!xyz:{
    a!map(id: 1, name: "Jane Doe"),
    a!map(id: 2, name: "John Doe")
  },
  a!forEach(
    items: local!xyz,
    expression: a!map(
      id:fv!item.id,
      name:fv!item.name,
      newKey1:null()
    )
  )
)

harshitb6843
September 29, 2022

You can use a!update(). It is used to update the value of the passed key and if the key doesn't exist, then it will create a new one.