Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
3 replies
Subscribers
8 subscribers
Views
5388 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Cast multiple type into single
erick258
over 8 years ago
Hi, is there a method to obtain the type of a certain multiple variable? Say ri!a, which is a multiple text variable, I want ri!b to have the same type of ri!a but not multiple that is a text variable. I found out that it can be done by typename(typeof(ri!a)-1) for a CDT type, but the same doesn't work for appian primitive data type. Any suggestion? Thanks
OriginalPostID-246569
Discussion posts and replies are publicly visible
0
sikhivahans
over 8 years ago
@erick I am not sure if it's a standard way but you can give it a try as follows:
Type number of Number Integer = 1, Type number of Number Integer Multiple = 101
Type number of Number Decimal = 2, Type number of Number Decimal Multiple = 102
Type number of Text = 3, Type number of Text Multiple = 103
Type number of Boolean = 26, Type number of Boolean Multiple = 126
If you observe the pattern above, the difference between single value and an array is always 100. I believe this holds well for Primitve Data Types.
Even the following will do the job for Primitve as well as Complex data types as long as the array holds a value and is not null:
fn!typename(fn!typeof(fn!index(ri!input,1)))
/*Should work provided if you are not trying to take the data type of Input as Any Type and trying to implement a generic rule.*/
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
erick258
over 8 years ago
@sikhivahans AFAIK for Complex data types pattern is different with the primitive one, in which for Complex data types single value and array type difference is 1, which is different with Primitive Data Types that is 100.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
rodgraham
Certified Lead Developer
over 8 years ago
The solution @sikhivahans has suggested, is to use the type of the first element of the array so it won't matter what the difference in the number is between the single value and the array
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel