Expand my Community achievements bar.

SOLVED

How to check if a parameter value is an arrray?

Avatar

Level 4

Hi, 

In a Fusion Tools Module I'm trying to set a variable with the first item selected in a multi-select dropdown. However, if only one item is selected, Workfront returns the value as a string rather than an array with one value. This is quite frustrating, but I thought I'd just check to see if the value is an array or not, but there don't seem to be any functions to do this.  I've tried length, but that just returns the number of characters if a string is returned.

Does anyone have any advice?

Rob

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can do something like this

 

if(length(get({variable};1))>1,array,string)

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

You can do something like this

 

if(length(get({variable};1))>1,array,string)

Avatar

Level 4

@ChrisStephens 

Sorry, I missed your reply. Thank you. I hadn't seen the GET function, this is useful. 

I know this is a different question slightly... but is there such a function like isArray()? to tell whether the value returned from a multiselect is an array or not?

 

Currently I use join() using an obscure separator, then I check for the existence of the separator. That's all I could think of.