Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with actions "on activate"

Good day,

I want my application to have the following behavior:

- if in the "Field 1" there is only 1 value possible other than "other", select this value

- else select nothing

In my actions, I set :

- clear all

- Field1: =if(count(distinct if(Field1 <> 'other', Field1)) = 1, only(if(Field1 <> 'other', Field1)))

This should work.

BUT, when I activate the sheet with a previous selection, the "clear all" statement is not done first.

Exemple:

My data are the following :

LOAD * INLINE [

Field1, Field2

A, 1

B, 2

other, 1000

];

If I have a previous selection in "Field2" with only 1 element, the result of the actions "on activate" is that 1 value is selected whereas none should be selected.

It is like if the "count" function was done before the "clear all" action.

A solution is to use the following formula :

=if(count({1} distinct if(Field1 <> 'other', Field1)) = 1, only({1} if(Field1 <> 'other', Field1)))

but I think that the fact the actions are not done in the correct order is a bug.

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

   Please have a look at the example attached here with.

   Hope this is what you want.

   Delete 1 value from the field and reload it again and check.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

If I have only "A" and "other", I select "other", I go to the sheet --> nothing is selected.

The usage of "invert selection" is quite counterintuitive

I have a solution using

=if(count({1} distinct if(Field1 <> 'other', Field1)) = 1, only({1} if(Field1 <> 'other', Field1)))

but I'd like to know why "clear all" is not done first.

How can I suggest a bug ?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Actually it did, but then you had the if statement, i think that didnt work.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
llauses243
Creator III
Creator III

Hi Nicolas,

For me all ok, pls see .rar adjust for explain

Good luck, Luis

Not applicable
Author

Good day Luis,

Unfortunately, I don't understand what your application shows.

Do you say that, for you, the selection of "B" doesn't affect the :

- CLEAR ALL

- Field1 = if(count(distinct if(Field1 <> 'other', Field1)) = 1, only(if(Field1 <> 'other', Field1)))

?

llauses243
Creator III
Creator III

Hi Nicolas,

For me when you select a unique value  in Field2 in tab 1 (in Field1 only is possible a value), then when pass to tab 2 (with option Set Anz $), automatic deselect value in Field2 (Clear All), after by Select in Field for Field1 is select a only value¡¡, then for me all ok.

Good luck, Luis.

Not applicable
Author

I go to the first sheet and make sure 1 value is selected:

2011-07-25_170511.png

Next step, I click on the second sheet.

What I expect is :

- CLEAR ALL --> nothing is selected

- =if(count(distinct if(Field1 <> 'other', Field1)) = 1, only(if(Field1 <> 'other', Field1))) --> there is 4 values different than "other" if "Field1", so, I should select nothing in "Field1"

What I have is:

2011-07-25_170619.png

A value is selected in "Field1", and it's wrong.

I suppose that the "clear all" is not taken into account when my formula "if(count(distinct if(Field1 <> 'other', Field1)) = 1, only(if(Field1 <> 'other', Field1)))" is calculated, whereas the "clear all" is the very first action.

I tried with QV 9 SR7 and QV 10 SR2.

Wich version do you use ?