Hi:
I was experimenting with the Grid example in Appian Tutorials (https://docs.appian.com/suite/help/23.1/Grid_Tutorial.html) and noticed that I had some rows with no firstName and LastName. So, I thought I would use "fv!row.firstName" as part of the showWhen-attribute to prevent those rows from being show (see image below). However, I am getting "scoping error" messages. I know I can use query to filter out those rows but thought I would experiment with this approach because I have had issues with understanding local-variable scoping. For example, when I use {} right after a!localVariables (), I get scoping error (see second image.
Any responses to helping me understand local-variables/scoping would be appreciated.
Thank you.
Ma
Discussion posts and replies are publicly visible
It's simple. The variable is accessible within the block into which it is defined.
See the following to understand it better -
a!localVariables( local!a: 1, { a!localVariables(local!b: 2, local!a), local!b } )
Abhay,
That was understanding - variable is available within the defined block. Unless, I am missing something, I don't see why line 8 in my example (second image in my original post) gives an error when the variable is defined on line 3. However, if I remove the braces on line 2 and 24, the error goes away (see image below).
Madhu
Please try to understand the syntax of a!localVariables().
a!localVariables( localVar1, localVarN, expression )
In your image2, you have defined local!productsList without using localVariable() which is violating the syntax because it is the expression portion.
use something like following.
a!localVariables( { a!localVariables( local!productList: rule!abc(), a!gridField() ) } )
See the color coding to understand it better.