How to write an expression rule that returns multiple values? Would you share an example?
Discussion posts and replies are publicly visible
Just an aside...in a future release of Appian you'll be able to return data in 'map' format (this is already generated from a Decision Rule if you have multiple outputs of different data types) but you'll have access to the a!map() function natively, as per the following example:
a!map( myInteger: 99, myString: "Ipsum Lorem", myDecimal: 3.14159, myBoolean: true, myIntegerList: {3,5,7,9} )
The above code returns the following output:
This will bust the current limitation where Expression Rules can only return one 'type' of data as their final result.
What will be the difference to the "{}" dictionary?
+1, curious what benefits this offers compared to essentially returning an "any type" dictionary.
That when extracting the values from the map the value won't be wrapped in a variant but will be natively of the type expected:
{ myInteger: 99, myString: "Ipsum Lorem", myDecimal: 3.14159, myBoolean: true, myIntegerList: {3,5,7,9} }.myInteger
returns:
whereas:
a!map( myInteger: 99, myString: "Ipsum Lorem", myDecimal: 3.14159, myBoolean: true, myIntegerList: {3,5,7,9} ).myInteger
According to the feature description:
"[this]...will help to reduce unexpected errors in your interfaces and rules. Maps will simplify your expressions and make it easier to work with other types."
oh, that sounds great then - i can finally get rid of this nervous twitch i've developed over time by being caught off guard by weird type mismatches
Hah, likewise! I can't promise you which release of Appian it'll arrive in but it's in progress.
Really nice little feature!