Skip to main content
Inspiring
Mar 23, 2023 11:57 PM UTC
Question

How to remove items from list of dictionary?

List of Dictionary - 3 items
Dictionary
  icon:"arrow-circle-o-left"(Text)
  action:26(Number (Integer))
Dictionary
  icon:"sitemap"(Text)
  action:25(Number (Integer))
Dictionary
  icon:"check-circle-o"(Text)
  action:28(Number (Integer))

As i want to remove second item from dictionary what should i do 

10 replies

santiagor1617
New Participant
Mar 24, 2023 1:19 AM UTC

Hi Klaus34, you can use the function remove() and select the index that you want to delete, example, remove(local!array,2) 

ayusha3676
Inspiring
Mar 24, 2023 11:48 AM UTC

a!localVariables(
  local!map: {
    { icon: "arrow-circle-o-left", action: 26 },
    { icon: "sitemap", action: 25 },
    { icon: "acheck-circle-o", action: 28 }
  },
  remove(  local!map,2)
)

sivakrishnam0002
Known Participant
Dec 10, 2023 1:32 PM UTC

[mention:c4f93897cfed4b188e78b2223ce098f3:e9ed411860ed4f2ba0265705b8793d05]  As i want to remove all items from dictionary. Can you please help me

stefanhelzle0001
Brainy
Dec 10, 2023 2:29 PM UTC

When you remove all items from a list, you end up with an empty one. I am not sure what you are looking for. Can you explain your specific scenario?

Keep in mind that variables in Appian expressions are immutable. Once declared, you cannot modify them. In an interface, this is different, you can update variables as a result of user interactions.