Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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')
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')
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
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