Skip to main content
July 11, 2025
Solved

How to update a object without a new variable.

  • July 11, 2025
  • 7 replies
  • 0 views

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.

    Best answer by stefanhelzle0001

    Appian expressions follow a functional paradigm. Variables are immutable.

    7 replies

    shubhama926776
    July 11, 2025

    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 }
    )
    
    
    

    stefanhelzle0001
    July 11, 2025

    Appian expressions follow a functional paradigm. Variables are immutable.

    July 11, 2025

    So sad, it's really inflexible. Thank you for your answer.

    stefanhelzle0001
    July 11, 2025

    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

    harshas2775
    July 11, 2025

    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})

    July 11, 2025

    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

    harshas2775
    July 12, 2025

    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!