I have a list like {1,2,3,4}, I want to add new items like {1,2,3,4,5,6,.....} in the same list without using a new variable to store the new list.
Discussion posts and replies are publicly visible
In Appian Variables are designed to be permanent once created - you can't alter them after initialization. To make changes, you must build a brand new variable that incorporates your modifications while leaving the original intact.Hope you are expecting this when you want to append list...
a!localVariables( local!originalList: { 1, 2, 3, 4 }, local!listToAppend: { 5, 6, 7, 8, 9, 10 }, { local!originalList, local!listToAppend } )
Appian expressions follow a functional paradigm. Variables are immutable.
you can use append() function if you want t add at the end of list always or use insert function if you want to insert at specific indices/index
insert({1,2,3},{4,5,6},4) append({1,2,3},{4,5,6})
I know how to update a list, what I want to ask is how to update in the same object. after insert or append I need a new variable to receive. That's not what I want. It seems appian not support this behavior
So sad, it's really inflexible. Thank you for your answer.
Why is that inflexible? It is just a different way of doing things. And, among other things, it avoids side effects.
https://docs.appian.com/suite/help/25.2/functions-side-effects.html
If you want to update the same variable then try manipulating the list inside saveinto of a interface component and keep the target also there same variable. Eg
a!save(ri!value, append(ri!value,{4,5})
Similarly in process models output tabs within nodes allows to perform operations on a list and saveinto the same original variable. Apart from this, without using any variables in picture, there is no way to perform operations and keep it stored or pass along in processes!