Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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.

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: GetFieldSelections to Array?

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
Highlighted
MVP
MVP

Re: GetFieldSelections to Array?

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

Highlighted
Not applicable

Re: GetFieldSelections to Array?

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

Highlighted
MVP
MVP

Re: GetFieldSelections to Array?

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