Cast multiple type into single

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

  • @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.*/
  • @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.
  • 0
    Certified Lead Developer
    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