Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
SamWeatherby
Contributor
Contributor

Qlikview - Select in field when GetSelectionCount = 0

I have two list boxes, lets call them 'Service' and 'Service User'. I'm trying to force a selection in the 'Service User' field when the count of the selections in the 'Service' field equals zero. I was advised to start with the use of a variable in the following manner:

=If(GetSelectedCount(Service) = 0, 'Y','N')

The above works correctly in the text object when I make selections in the Service field list, however, when I create a variable with the exact same code as above and then put this variable into a text object, it only even shows as 'Y' which is incorrect. I've seen similar type queries on the community but no solid answers.

If there is an alternative method to forcing a field selection then I'm open to all suggestions. I basically want to force the 'Service User' field to 'Joe Bloggs' for example, when the GetSelectedCount on the 'Service' field = 0

Labels (1)
1 Reply
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Sam,

You should be able to build something of this kind using Actions and Triggers in QlikView, however it sounds like you might have an opportunity to model your data differently and avoid "trickery" with selections. I don't know enough about your business needs, but I am pretty sure that there has to be a more elegant solution than the one you are looking to build. Playing with selections ends up to be counter intuitive for the users and annoying at the end...

For example, you could achieve something like this in Set Analysis, which you could add to your Expressions. You could have a variable that holds the desired values in the field ServiceUser. The variable could have this formula:

vServiceUserFilter=  "= If(GetSelectedCount(Service) = 0, 'ServiceUser', '{''Joe Bloggs''}')"

In Set Analysis, you could have a filter like this:

ServiceUser = $(vServiceUserFilter)

It would either select all values of ServiceUser or Joe Bloggs, depending on the selections.

This is just one of many options that avoids playing with selections "behind the scene".

Cheers,