Discussion posts and replies are publicly visible
Without knowing a bit more detail about your use case, all I can say is that you'd need to add some sort of button or link in order to save the variable somewhere else (such as into a rule input to be passed back into a process variable).
User interaction is required to execute a saveInto, which in general is why the rich text display field doesn't have it.
Thanks Mike.
I reframed the question as below coding exercise. As you see, the below does not need a user-interaction component. Can we still do this with SAIL?
Of the below text arrays, display the ones containing the words "rises" and "likes" in one section, and display the rest separately. I guess we can use two different rich text display components for each section.
Can you please type in a few lines of code to accomplish this? Does this make sense?
"Today is Tuesday", "Sun rises in the East", "Charlie likes milk", "Amanda lives in New York", "Time and Tide waits for none"
You would take care of all such logic in the local variable declarations themselves. See my example revision to your original code snippet:
a!localVariables( local!allNumbers : {1,2,3,4}, local!evenNumbers: a!forEach( items: local!allNumbers, expression: if( mod(fv!item, 2) = 0, fv!item, {} ) ), { /* show the second array */ a!forEach( items: local!evenNumbers, expression: a!richTextDisplayField( value: {a!richTextItem(fv!item)}) ) } )
Hi Mike, Thanks for this. It is true when declaring variables such logic can be applied.
However my original question was to update the variable after the declaration, and on cases where there are no interacting UI components. In my original question, I deliberately kept the declaration of local!evenNumbers as empty, because I want to update it later. So unfortunately it doesn't answer my original question. I hope I'm able to articulate this problem.
My original answer still applies, then - user interaction on a form is required in order to make later modifications such as the ones you're after. This is the way Appian Expression Language, along with its system of local variables, is designed to work at a core level.
I realize it's probably confusing for certain people, such as those accusomed to more traditional programming languages, but it would be a good idea to get used to how it works in Appian's case as it will make dealing with more advanced logic easier going forward.