Hello community,
I wonder if it is possible to check with in a if condition if a passed value of any type is a CDT.I want to make a generic expression rule to convert a body from JSON to CDT with two rule inputs.1 body of type text.2 any type, but only CDT's so no integer, string etc.
So I want the to JSON function only to execute when the ruleinput is a CDT, if not I want to return a custom error message text string.Are the CDT in a specific reserved numeric range so I can use that, or is there another approach?
Kind Regard,
Erik
Discussion posts and replies are publicly visible
You create a dictionary not via type but via {} or map(). See docs.appian.com/.../Expressions.html
Like Stefan said, I don't believe you can define a dictionary using a type constructor - usually the easiest way is to just define an array and add any keys you want to use, which will automatically define a dictionary. Here's an example:
{ {id: 1, text: "One"}, {id: 2, text: "Two"}, {id: 3, text: "Three"} }
That being said, if you plan to construct the data yourself, I highly recommend using a map instead of a dictionary. Maps provide the same flexibility of dictionaries in that you can define any keys you want to use, but a key difference between maps and dictionaries is that maps are strongly typed. If you use a dictionary, you will see all the fields show up as a type "Variant", which means they can be anything. If you use a map though, the types will show as "Text", "Integer", etc. This makes it much easier to use the data in a map. You can construct a map with a similar syntax, just use a!map() instead of the brackets:
{ a!map(id: 1, text: "One"), a!map(id: 2, text: "Two"), a!map(id: 3, text: "Three") }
thank you, makes sense.
Thank you Peter, I will keep in mind to use maps instead of directory when the datatypes of the fields matter(or just use maps in general instead of dictionary.
After restarting my computer and installing the computer monitoring software, the settings are out of order, I want to return a custom error message text string.Is CDT in a certain reserved numeric range for me to use, or is there a different approach?