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
Discussion posts and replies are publicly visible
Hi Klaus34, you can use the function remove() and select the index that you want to delete, example, remove(local!array,2)
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) )
Ayush Agrawal As i want to remove all items from dictionary. Can you please help me
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.
a!localVariables( local!map: { { icon: "arrow-circle-o-left", action: 26 }, { icon: "sitemap", action: 25 }, { icon: "acheck-circle-o", action: 28 } }, ldrop( local!map, count(local!map) ) )
a!localVariables( local!map: { { icon: "arrow-circle-o-left", action: 26 }, { icon: "sitemap", action: 25 },
{ icon: "sitemap", action: 29 }, { icon: "acheck-circle-o", action: 28 }, { icon: "arrow-circle-o-left", action: 26 }, { icon: "sitemap", action: 29 },
{ icon: "sitemap", action: 25 }, { icon: "acheck-circle-o", action: 26 } ldrop( local!map, count(local!map) )},)
we have a requirement where in the above code if we use that, it will delete all the rows. But we need to delete only specific rows.Example: { icon: "arrow-circle-o-left", action: 26 }, I want to delete all rows when value matches with action:26 can you please help us with this requirement
a!localVariables( local!map: { { icon: "arrow-circle-o-left", action: 26 }, { icon: "sitemap", action: 25 }, { icon: "acheck-circle-o", action: 28 }, { icon: "star", action: 26 } }, remove( local!map, wherecontains(26, tointeger(local!map.action)) ) )
You can try this code
Kiran Thanks you so much. Its working as expected.
or without using "remove()" and "wherecontains()" nested - this way works but can be harder to debug and harder to understand. i prefer a!forEach() wherever possible.
a!localVariables( local!map: { { icon: "arrow-circle-o-left", action: 26 }, { icon: "sitemap", action: 25 }, { icon: "acheck-circle-o", action: 28 }, { icon: "star", action: 26 } }, a!forEach( local!map, if( fv!item.action = 26, {}, fv!item ) ) )