Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vlad_komarov
Partner - Specialist III
Partner - Specialist III

GetSelectedCount and Alternative State

Hello!

Is it possible to use an Alternative State option for functions like GetSelectedCount()?

I need to check the number of items selected for the field that has the Alternative State set for.

I will appreciate any suggestions.

Best regards,

Vladimir

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Your problem will be solved in the QlikView 11.20 SR8.

Qlikview 11.20 service release 8 beta is now available

New parameter added to the functions “GetSelectedCount()”, “GetFieldSelections()and“GetCurrentSelections()” to query other states than the main state. E.g. =GetFieldSelections(Quantity, ';', ,'StateA')

View solution in original post

9 Replies
Not applicable

You can try some thing like this =count({State name}field)

CELAMBARASAN
Partner - Champion
Partner - Champion

There is no option for that.

Those functions acts based on the object state. If your using this in text object then that object state should be in that state.

You can vote up the idea her http://community.qlik.com/ideas/2340

vlad_komarov
Partner - Specialist III
Partner - Specialist III
Author

Yes, I saw this idea in the "Suggestions" article (http://community.qlik.com/ideas/2340). It works, but it's affecting performance of my application significanly. I have very unusual case, but it should work much faster with standard GetSelectedCount implementation...

Thanks!

Vladimir

vlad_komarov
Partner - Specialist III
Partner - Specialist III
Author

Did vote there.

Thanks!

Vladimir

Not applicable

is there any way to get selected field value in alternative states?

something like getfieldselections([state1],field)

Lee_Matthews
Former Employee
Former Employee

If you have a field in the default state that matches the one in the comparison state, you can count all values in the field from the default state and subtract a distinct count from the comparison state. If the value is less than zero, then something has been selected.

Its not pretty, but here is an example:


Count(distinct {[Compare1]} Field) - (GetSelectedCount(Field)+GetAlternativeCount(Field)) < 0

Vegar
MVP
MVP

Your problem will be solved in the QlikView 11.20 SR8.

Qlikview 11.20 service release 8 beta is now available

New parameter added to the functions “GetSelectedCount()”, “GetFieldSelections()and“GetCurrentSelections()” to query other states than the main state. E.g. =GetFieldSelections(Quantity, ';', ,'StateA')

vlad_komarov
Partner - Specialist III
Partner - Specialist III
Author

Vegar Lie Arntsen,

Thank you for feedback!

Will test the new functionality.

Regards,

VK

Not applicable

In case it helps others...

I think it's worth noting that I have also experienced appalling performance degradation on a complex application which also used the suggested workaround.  I tracked this degradation down to the use of this logic:

SubStringCount('|'& Concat(DISTINCT {AdHoc} $1,'|')&'|', '|'& $2 &'|' )>0

I had a large number of customisable tables which had expressions and dimensions that could be dynamically selected by users.  By removing this logic, and instead using a system field in the default state in conjunction with some logic that Rob Wunderlich had mentioned in a comment on another post (sorry - can't find the link now - I think it was on the sample app using bitand/bitor), the performance improved dramatically.

This is the new logic I am using.

GetSelectedCount($1) AND max(match($1,$2))

So whilst the SubStringCount work around did work to get values from an alternate state (pre 11.2 sr8), use it cautiously as it may have performance implications.