Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

GetFieldSelections to Array?

Hiya Guys,

I am looking to evaluate whether or not the current Selections are in succession (ie: selecting Months 1,2,3,4 - rather than holding CTRL and selecting Months 1,3,5,7).

In the macro I am writing my first thought was to convert the list returned by GetFieldSelections(MonthNumber, ',', 12) into an Array - and then use a For Each loop to cycle through the entries and evaluate them.

Is there a function which will convert GetFieldSelections into an Array?... or is there a better way of achieving this?

Cheers,

Steve.

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Maybe something like this would return the answer for your specific issue:

=if( ( ( max(Month)-min(Month) +1) / count(distinct Month) ) =1, 'Succession','With gaps')

View solution in original post

3 Replies
swuehl
Champion III
Champion III

Maybe something like this would return the answer for your specific issue:

=if( ( ( max(Month)-min(Month) +1) / count(distinct Month) ) =1, 'Succession','With gaps')

Not applicable
Author

Thanks swuehl,

I haven't had chance to test this but the mathematics look correct.

However, ideally I need to be able to store each value selected - and then loop through them to perform an operation on each one.

Cheers,

Steve.

Edit:  Although, as I'll know the Max and Min (and whether or not they are in succession) I should be able to use a For Loop... if I manage using this method I will mark your post as "Correct"  🙂

Message was edited by: bainsteven

swuehl
Champion III
Champion III

I noticed that you are evaluating GetFieldSelections in a macro like this

http://community.qlik.com/thread/57371

i.e. you are getting a string back, right?

I think there a probably better ways to handle this if you need to look at the separate values anyway, maybe like

http://community.qlik.com/message/122090#122090

Hope this helps,

Stefan