Default Values for Variables in Apps

Dear Community,

does anybody know if (or why) the default value of a variable is somehow treated differently than a value that is set during using the App?
I noticed that in a query, the default value of a string variable was ignored and then I tried to just show the value via an HTML element. But also in the HTML, the default value of the variable is not shown, only once I change the value via some other means, I can see a value in the HTML.

Hi Magdalena,

I cannot reproduce the behavior in this test app.
Could you maybe explain a bit more on how you are configuring your variable an app?

Kind regards

Hi Magy,

thanks for the reply and thanks for making me implement it in this test app! :smiley:
This way I noticed that actually the problem is not the default value but the problem is, that by the default value I cannot “fake” an array.
What I am trying to do is, use the value of the variable in a Query statement that applies the transformation “sqlList” on the variable. This is possible on a (string-) variable that contains an array.
You can see the desired behaviour in the test-app on the right, when you select entries from the Multiselect-Filter. However, even though the variables look exactly the same when you print them (see HTML elements on the top), this behaviour cannot be reached with just setting a variable to a value that “fakes” such an array.

The final, actually very simple, solution after extensive testing was to initialize the (string) variable with an actual array. Meaning the default would not be “[‘someValue’]” but [“someValue”].
This prevents an error message from being thrown if this variable is used together with the transformation “sqlList”.

1 Like