Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
swuehl
Not applicable

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

3 Replies
swuehl
Not applicable

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

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

swuehl
Not applicable

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