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

GetSelectedCount and alternative state

Hi!

Can I use "GetSelectedCount" with alternative state?

I am trying to create a conditional for my expression: sum({[Simulation State]}if([Project type] ='Back up project', Hours)) so that it would do the calculation only if there is at least one value selected in a field "Back up projects".

When I try if(GetSelectedCount( {[Simulation State]} [Back up projects])<>0, ....) it shows error line for the Alt State first curly bracket.. Is it a syntax problem? If I add only() between getselectedcount and alt state it says expression OK but it doesn't make it work as I want.

Thank you community already advanced!

Regards,

Heidi

1 Solution

Accepted Solutions
swuehl
MVP
MVP

=GetSelectedCount( [Back up projects], False(), 'Simulation State')

View solution in original post

8 Replies
sunny_talwar

maxgro
MVP
MVP

state is the 3rd parameter, field the 1st

this is from Qlik 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( ) )

swuehl
MVP
MVP

=GetSelectedCount( [Back up projects], False(), 'Simulation State')

Not applicable
Author

It shows an error after the false and without the false() it doesn't work either?

AltStateError.PNG

sunny_talwar

If you are using a version older than 11.2 SR8, the above won't work. This is because it got introduced in SR 8.

HTH

Best,

Sunny

sunny_talwar

Link for SR8 Beta Release which talks about this new added functionality in SR8: QlikView 11.20 Service Release 8 Beta is now available

Not applicable
Author

Hi!

Thank you Sunny and swuehl! I updated to the SR12 version and now everything works as they should (:

Regards,

Heidi

sunny_talwar

Awesome

I am glad we were able to help.

Best,

Sunny