Skip to main content
New Participant
Aug 4, 2022 2:42 PM UTC
Solved

How to get type of string array

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!

stefanhelzle0001
Brainy
Aug 4, 2022 2:55 PM UTC

a!listType(type!Text)

13 replies

csteward
Brainy
Aug 4, 2022 2:53 PM UTC

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)

New Participant
Aug 4, 2022 2:59 PM UTC

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

stefanhelzle0001
Brainy
Aug 4, 2022 2:59 PM UTC
stefanhelzle0001
Brainy
Aug 4, 2022 2:55 PM UTC

a!listType(type!Text)

csteward
Brainy
Aug 4, 2022 3:17 PM UTC

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)
      }
    )
  }
)