Define variable later

Certified Associate Developer

Hello!

I have a problem of following type:

a!localVariables(
  local!emptyArray: {},
  ...
  {
    ...
    a!forEach(
        ...
        a!localVariables(
            local!variableWhichChangesWithEveryIteration:{...},
            {
                /* Here I want to append the local variable's value to my empty array. Something like this: */
                a!save(local!emptyArray, append(local!emptyArray, local!variableWhichChangesWithEveryIteration))
            }
        )
    )
    /* my array will be used here */
  }
)

The problem is that value of the array won't refresh by itself (if I use saveInto in a textField, for example) and I don't know how to do it automatically...

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    The trick is, in Appian, if your value isn't being supplied by user interaction, then there's no reason you can't just declare the variable that way up-front.  There's no need (and also no way) to declare a blank variable then have some subsequent function call change it for you.  That's because you can just declare it that way from the start.

    a!localVariables(
      local!array: a!forEach(
        ...,
        "value that changes with each iteration"
      ),
      ...
    )

Reply
  • +1
    Certified Lead Developer

    The trick is, in Appian, if your value isn't being supplied by user interaction, then there's no reason you can't just declare the variable that way up-front.  There's no need (and also no way) to declare a blank variable then have some subsequent function call change it for you.  That's because you can just declare it that way from the start.

    a!localVariables(
      local!array: a!forEach(
        ...,
        "value that changes with each iteration"
      ),
      ...
    )

Children
No Data