Skip to main content
August 4, 2022
Solved

How to get type of string array

  • August 4, 2022
  • 13 replies
  • 0 views

Hi, fairly new to appian and I'm trying to use type! to get the type value of a string array. I'm currently using typeof({"A", "B"}) which is working, but seems very clunky. I'm sure there's a better way. Any help? Thanks!

Best answer by stefanhelzle0001

a!listType(type!Text)

13 replies

csteward
August 4, 2022

I wouldn't have any issues using that code in production, but if you want another way to do it, try:

fn!cast(103,null)

August 4, 2022

where is the 103 from and what's its significance?

stefanhelzle0001
Brainy
August 4, 2022
stefanhelzle0001
Brainy
August 4, 2022

a!listType(type!Text)

csteward
August 4, 2022

I misunderstood that you wanted the type value (103) instead of an empty string array.  I like Stefan's answer then [emoticon:c4563cd7d5574777a71c318021cbbcc8]

Also for reference, if you want a quick way in your environment to see the type numbers in Appian (we use this in a COE/internal report), plug this into an empty interface.  Appian data types are ~1-300, CDTs begin at 500.

Note, never apply the try() (or any other undocumented function) in production, although it would be nice to have, it is not supported currently and may be removed at any time. 

a!richTextDisplayField(
  label: "Data Types",
  value: {
    a!forEach(
      items: 1+enumerate(1500),
      expression: {
        a!richTextItem(
          text: concat(
            fv!item,
            " - ",
            /* do not use try() in production! */
            try(typename(fv!item),"")
          )
        ),
        char(13)
      }
    )
  }
)