Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
catalin
Partner
Partner

Check if selection value is possible

Hello!

Suppose I have this:

var r = app.GetFieldAsync(selection.fieldname).Result;
r.SelectValuesAsync(selection.fieldvalues, false, true).Wait();    

 

If  there are values which are not possible to be selected, what does the engine do? It reduces the selections to the possible ones?

 

r.SelectPossibleAsync(true).Wait();

 

But if I just select all the possible values from that field and I get the field again and get its datapages / cells, i would obtain a list of possible values to be selected in that field? 

My question is: do I have to inner join a given list of selection values with the output of SelectPossible on that field to eliminate the selections from the given list which are not possible?

Labels (4)
1 Reply
yko
Employee
Employee

Late response, so don't know if this question is still relevant for you, but the engine uses some heuristics to choose how to behave when selections are made. I don't know if this is formally documented anywhere but, but I think the heuristics are something like this:

  1. A selection of only "possible" values adds the newly selected values to the total set of selected values.
  2. A selection of only "excluded" values clears a part of the selection state so that the newly selected value is no longer excluded. The exact algorithm for choosing what to clear is unknown to me.
  3. A selection of both "possible" and "excluded" values at the same time will be similar to 1. with the difference that the extra "excluded" values will have no effect on the selection state. They will be remembered though, so if you later clear the selection of a field that makes the "excluded" value "possible" again, then it will immediately be treated as "selected".

I can recommend creating an app with the Ctrl+00 script and play around with it. Add a filter pane with for instance the dimensions Dim1, Dim2, Dim3 and Alpha to see how it behaves with different combinations of selections.