Bug in Append For Each interaction?

load( local!arrayOne, local!arrayTwo: a!forEach( items: enumerate(10), expression: append( local!arrayOne, fv!item ) ), local!arrayTwo )

Could anyone tell me what they expect the values of these two variables are?

I want to check if this is expected behavior, if this is expected use of the functions, and if this is a risk to the code.

 

Please don't feel the need to tell me how to correctly do this, I've just identified this form of loop in some code and I want to evaluate if this needs to be corrected as it is dependent on a bug that might be fixed.

  Discussion posts and replies are publicly visible

  • arrayOne - null, at no point is anything saving into it
    arrayTwo - a series of integer arrays each containing one integer, a!forEach returns an array of items, and within the expression context you are running an append function, would would return an array itself

    To guess at why you may be asking this, the append function does not save back into itself, it simply outputs after the operation, so even though one may think that doing append(testArray, 1) would result in the value of 'testArray' being 1, there is actually no changes being made or saved to 'testArray', which instead retains its original value no matter how many times it is run within an append() function

  • Ah I see.
    In that case I assume that the reason its returning {1,2,3 . . . } rather than {{1},{2},{3} . . . } is that Appian is automatically flattening the interior arrays.
    Alright that makes sense, thank you very much.