Hi,
I'm trying to save an array value to a local variable, it looks like getting saved, but when I check for the length of the local variable, I'm getting as 0. Where as when I save the same array during declaration of the local variable, I'm getting the length as expected.
What I'm missing here ? what is the proper way of saving into local variables after declaring them. I've tried using a!save() but no luck.. :(
Below are the snaps for your reference.
Assigning array after initialization
Assigning array during initialization
TIA :)
Discussion posts and replies are publicly visible
There are mainly only 2 places where you can "assign a value" to a local variable:
1) at declaration
2) as the result of a user interaction in an interface component
Seeing as this is an expression rule, and therefore #2 is irrelevant, you will need to assign the value at declaration (#1).
This is the most important concept here: There is no such thing, in Appian's expression language, as "define a blank local variable then in a later line of code give it a new value". If you know its initial value, then you will assign it at creation time.
Thanks Mike for your input.
If you know its initial value, then you will assign it at creation time. -- what if I don't know the value of the variable during initialization and the value would come after initialization as a result of some equation like we do in traditional programming. how to handle such scenarios.
Vasudeva said:the value would come after initialization as a result of some equation
You would declare its value after any other calculations (usually declared as their own local variables) on which it depends.
ok, so the rule of thumb is to initialize the local variable during declaration it self. Got it, thanks
basically, yes.
Where can I find more info on this, I have tried the expression section of the Appian documentation, but I couldn't find any thing, I'm looking for examples and howtos..
I have referred to this -> docs.appian.com/.../Expressions.html
The local variables section pretty much covers it.
docs.appian.com/.../Local_Variables.html
thank you will go through it... really this is a wonderful community