Declare text list in expression
Application Type
Traditional Web, Mobile, Reactive, Service
Service Studio Version
11.10.12 (Build 39237)
Platform Version
11.8.2 (Build 15398)

Hi,

I have occasionally seen this syntax when I search for a variable being used in an "expanded" input parameter. Is it possible to also use this kind of syntax in an expression, and what is it called? E.g. passing a text list to a function inside an expression, without needing to declare the list as a variable.

This is what I see when finding the occurrence of Arg0 used in the expanded input parameter.

This is my attempt using the same syntax, where the second argument of the function is a text list:

mvp_badge
MVP

Hi Emma,


Your function output's should be a list and your client action should be marked as a function in order for you to use it in the expression like that.

However, if you try to use a non-function client action like ListAppend or ListAppendAll in a client function, you'll get this error:


What you can do instead, although it is a workaround, is to have your list as a text and use JSON Deserealize to deserealize it into a list, like in the example below:



Hope it helps.


Kind Regards,
João

Thank you for your reply, but I already have a work around where I create different function definitions with n number of arguments. 

This is my current work around:



Ideally, I would have the Text input and the Text List input values visible in the same expression, like the C# params keyword, instead of creating different functions with n number of arguments. So I wanted to know if the syntax found in my question's first screenshot is possible.

mvp_badge
MVP

If you just need to have one function, you can pass a single JSON expression (e.g. "[" + Arg1 + "," + Arg2 + "]") and use a function with JSON Deserealize to get the TextList, like in my example above.


In this way, you have a single function, with only one text parameter where you can "build" your list using the same function, no matter the amount of items in the list.

I see how that would work, the only thing is finding a delimiter that isn't used a lot in plain text that is also developer friendly (this is a very generic function for formatting translation resources with parameters). Thanks.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.