Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to use GetCurrentSelections as a calculation condition for a particularly large straight table. I want users to select at least three conditions to limit the amount of data that is returned and prevent the report from running too slowly.
Here's what I have:
=count(GetCurrentSelections())>=3
But the QlikView application crashes when I run this.
Based on this discussion I've also tried
=len(GetCurrentSelections())>=3
This doesn't crash, but it also doesn't produce an error when fewer than three conditions are selected.
Any suggestions very much appreciated.
GetCurrentSelections() will return the selections in a string, so I believe the count of that string will never be larger than 1.
You can look into the optional arguments to GetCurrentSelections() to set special delimiter for records and values, and then use a substringcount to check the number of fields you selected in:
=SubStringCount( GetCurrentSelections('\'),'\') >= 2
(I am only comparing to 2 since a delimiter is separating two fields.
you can do a little trick:
=substringcount (getcurrentselections (chr(13), '=', ';', 10 ),'=')
Thanks very much, both answers are very helpful.
We decided to go a different way and use GetPossibleCount to limit the possible returns to 10,000. If there are more than that the user gets an error message saying 'Not enough selections. Please apply more filters.' until fewer than 10K records are returned.
That solved the speed problem.
Hi,
I believe you need to have a field name in your expression:
Like:
len(GetCurrentSelections(FieldName))>=3
Regard
Rahul
Hi Rahul, thank you for your input. We didn't want to limit the selection to one particular filter, we wanted at least three of the filters available to be selected.