Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

GetSelectedCount in alternate state

Hello.

I've been researching how to get a field selection count for various fields in various alternate states and am not really seeing how to execute the formula. I've tried different things but finally decided to throw it out to you experts.

Here's my ultimate goal...I need to be able to do a logical test on whether at least one field selection has been made in various alternate states. I am looking for either a true (there has been at least one selection made in a specific field) or false (no selections have been made).

Here's what I'm using without alternate state and it works fine...

GetSelectedCount([Field_A]) > 0

--1 = yes there was at least one selection made

0 = no selection was made

I need to add alternate state to this but it can't be done in the alternate state box on the general tab because I will need to do a nested formula where I look at selection counts for multiple fields in multiple alternate states. How would I add alternate state to the formula above?

Thanks so much for your help.

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

Like this for example, state name with quotes

=GetSelectedCount(Year,False(),'Group')

View solution in original post

6 Replies
marleygt
Creator
Creator

Hi pepsiyummie!

You might be able to do that through Set Analysis, using the " [State Identifier]" and "::".

Have a look at the Built-in Help in Qlikview.

Or if you could attach a sample of what you need....

Have a nice day!

Alex

stigchel
Partner - Master
Partner - Master

Depending on which version of qlikview you are using, there is a (3rd) parameter in GetSelectedCount for that. I think starting 11.2 SR5(?) or so

From the help:

getselectedcount (FieldName [, IncludeExcluded [, State]])

Returns the current number of selected values in a field. It is possible to query an alternate state.

If IncludeExcluded is true the count will include selected values, which are currently excluded by selections in other fields. If false or omitted these values will not be included.

State is the alternate state to query.

Examples

getselectedcount ( Year )

getselectedcount ( Year, true( ) )

Not applicable
Author

I did see that in help but when I tried to implement it I was clearly not doing it right. Can you please help me by translating this formula...

=GetSelectedCount([Field_A]) > 0


into the help formula...


getselectedcount (FieldName [, IncludeExcluded [, State]])


I had no success at it! Thanks so much.

stigchel
Partner - Master
Partner - Master

Like this for example, state name with quotes

=GetSelectedCount(Year,False(),'Group')

Not applicable
Author

Bingo! That is exactly what I needed. Thank you all for your help.

Piet - you nailed it for my particular example. Thanks so much.

I am always very grateful for the help of this community!

stigchel
Partner - Master
Partner - Master

You're welcome