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

Problems with Field Event Trigger

Hi,

I have 2 questions. I am using the personal edition so it would be helpful to copy and paste the codes here ( I can't open any attached Qlikview document).

1) I have set up a field event that triggers certain actions upon selection of a field, say Field A, in Sheet 1. However, I would like to have another set of actions to be triggered upon selection of Field A in Sheet 2. Is this possible? The field event trigger seems to be universal throughout the entire document and I can't get the trigger to work differently based on the active sheet.

2) Also on field event trigger. Is it possible to activate the field event trigger conditionally based on values of the fields?

E.g. My data looks like this:

Field AField B
applefruit
orangefruit
USAcountry
pastaN/A

My field event trigger works like this. when Field A is selected, I would want the possible values from the corresponding Field B to be selected and clear the selection from Field A. (I need to do this because my other tables are linked to Field B and not Field A).

However, for cases where Field B is 'N/A', I would not want this field event to be triggered and the filter remains on Field A.

Is this possible? With a macro perhaps?

Appreciate any help, thanks.

3 Replies
Anonymous
Not applicable
Author

Dear,

it's quite difficult explain solutions to these questions without an example application

1) You can create an Alternate State, say "State1" (Document properties> Alternate States...>Add).

In the objects in sheet1 set <inherited> while in objects in sheet2 set State1 (General tab of object properties, alternate state).

Now selections in sheet1 will be independent from those in sheet2.

You can do this just for Field A if there are two list boxes, on for each sheet.

Then you are able to add different sets of triggers for the two states (you will find State option as shown below)

2) You can add two actions OnSelect for FieldA:

- Select in field:  in field option insert FieldB and in Search String insert =FieldB

- Clear other fields: in field option insert FieldB.

For N/A values, you can add an if statement in searh string in order to handle this case.

Obviously, if you add alternate states, you must specify wich state you are considering, as in image above.

Can this help you?

Please, ask again if it's not clear!

Elena

maxgro
MVP
MVP

1)

you can use an if with getactivesheet function (it returns the Sheet ID you find in General tab of shhet properties) in trigger event for the field

=if(wildmatch(GetActiveSheetId(), '*SH01*'), 'Match', 'Not match')

nagaiank
Specialist III
Specialist III

1. Under Settings -> Document Properties -> Triggers,

Define two Field Event Triggers for Field A (both for OnSelect and OnChange

Capture.PNG

2. First trigger for Field B

Set the action and search string as shown below

Capture1.PNG

3. Second trigger for Field A

Set the action and search string as shown below

Capture2.PNG

You will see the following:

If you select 'apple' in Field A, 'fruit' will be selected in Field B and Field A will be cleared.

If you select 'pasta' in Field A, nothing will be selected in Field B and Field A will not be cleared.

Hope this helps.