Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use trigger to select values in one field based on values in another

Hi community,  You guys are great and I really appreciate all your help!  If I have a field that has 12 values say A, B, C and woul like each of those to trigger the selection of a different value say 1, 2, 3, how would I do that?  I think I'd need to use a trigger.  I'd like something like selecting A in field ONE to select 1 in field TWO and selecting B in field ONE to select 2 in field TWO.

1 Solution

Accepted Solutions
oscar_ortiz
Partner - Specialist
Partner - Specialist

Here's a way of doing this using triggers.

Good luck

Oscar

View solution in original post

20 Replies
oscar_ortiz
Partner - Specialist
Partner - Specialist

Here's a way of doing this using triggers.

Good luck

Oscar

Not applicable
Author

What a community!  Thanks a bunch Oscar!

billbois
Creator
Creator

Great solution, Oscar!

I need something similar, but it has to allow the user to select more than one option.  In Oscar's demo, if the user selected A, C and D in the F1 field, the F2 field would have to select 1, 3 and 4. 

In my case, the values are the same but the field names are different, so selecting A, C and D in F1 would select A, C and D in F2.  I've tried GetFieldSelections() to no avail so far.  Any suggestions?

oscar_ortiz
Partner - Specialist
Partner - Specialist

Bill,

In order to accomplish what you were aksing for I needed to create a new field in my first table that corresponds to data in the field from the second table.

Then using the follwoing expression as part of my trigger:

='('&Concat(Distinct F3,'|')&')'

In my example I have the orignal trigger for a single value associated to the field itself.  The multiple value selection i have asscoiated to the button.  Just check on the properties.

Good luck

Oscar

billbois
Creator
Creator

Oh my, that's perfect!  It's simple and elegant and exactly what I've been looking for.  Thanks a million!

Anonymous
Not applicable
Author

Oscar,

That's a great solution - Unfortunately, it does not appear to work for multiple text values. If I select a single value in the trigger field, it selects the corresponding value in the other fields (I need it to select in two other fields). However, if I select multiple values in the trigger field, I get no selections at all in the other two fields. Any idea how to fix this?

Thanks,

Kent

oscar_ortiz
Partner - Specialist
Partner - Specialist

Kent,

Use the button labeled "Test".  The original document was to select one value in one field based upon one value on another.  That is using a trigger based upon a field.  The second request was to allow multiple values to be selected.  Using the button I've accomplished this task.

Look at the properties of the button to see how it was done.

Good luck

Oscar

Anonymous
Not applicable
Author

I discovered the problem with the posted example - Some of the values that could be selected contained spaces, which break QlikView's search unless they're enclosed in double quotes.

To get this to work every time, build a list that looks like this:

("Value 1"|"Item 7"|"Widget 12")

Anonymous
Not applicable
Author

Interesting. I was using GetFieldSelections for this, but when you select all, it tries to select "ALL" in the other fields. So, I went back to the concat distinct method used in the example, but when I Clear, it clears the selection field, but not the two triggered fields unless I hit clear a second time.

Still looking for the ideal solution!