Skip to main content
faraza4154
Known Participant
Sep 29, 2022 9:17 AM UTC
Question

Adding new key values in list of dictionary in all rows

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
Sep 29, 2022 9:55 AM UTC

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
Brainy
Sep 29, 2022 10:20 AM UTC

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.