Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Using GetCurrentSelections as a Calculation Condition?

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. 

5 Replies
MVP
MVP

Re: Using GetCurrentSelections as a Calculation Condition?

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.

Not applicable

Re: Using GetCurrentSelections as a Calculation Condition?

you can do a little trick:

=substringcount (getcurrentselections (chr(13), '=', ';', 10 ),'=')

Not applicable

Re: Using GetCurrentSelections as a Calculation Condition?

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.

Not applicable

Re: Using GetCurrentSelections as a Calculation Condition?

Hi,

I believe you need to have a field name in your expression:

Like:

len(GetCurrentSelections(FieldName))>=3

Regard

Rahul

Not applicable

Re: Using GetCurrentSelections as a Calculation Condition?

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.

Community Browser