Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Force Selection

I've searched high and low in QlikView helpfile but I can't seem to find any command that would allow me to force a field selection based on another selection.

Ie) if I select Department "South Weld" can I force another field to select a specific criteria. So Department pick "South Weld" then field Category selection will be "Production".

Thanks in advance.

7 Replies
Not applicable
Author

You could handle this with a macro.

For fields, you can set an OnSelect macro in the Document Properties. In that macro, you would need to check what value is selected and then make the appropriate selection in the other field. For simplicty, I would probably create a variable with the definition: =GetFieldSelections(FIELDNAME). Then you would check the value of that variable before making the second selection.

If you're using QlikView 9, I believe this can be accomplished using Actions and a Trigger.

johnw
Champion III
Champion III

You may not be finding it because it is a fundamental part of how QlikView joins information together. What I would do is actually REMOVE any rows of data that don't match the specific criteria you want to force. So for the example, you want to remove all rows of data where the Department is 'South Weld' and the Category is NOT 'Production':

INNER JOIN ([Raw Data])
LOAD ID
RESIDENT [Raw Data]
WHERE NOT ( Department='South Weld'
AND Category<>'Production');


With that done, selecting the department 'South Weld' will force the Category selection to be 'Production' as desired.

It's often but not always best to just add the conditions to the original load rather than doing an inner join.

Not applicable
Author

It's Miller time!

I used triggers and it worked like a charm 🙂

Mr. Witherspoon - I know it's not a very good approach from a best practice stand point, but it does what I want it to do considering it's third party data provided from an excel spreadsheet using data within our ERP for some cost analysis. I kind of want to keep the tables seperate.

Thanks for all the advice.

Not applicable
Author

Hi Chhai Sun,

I have the same problem as you do. I am trying to solve it by using 'Triggers' and 'Actions' in QlikView 9, but it doesn't fully work.

Do you also use 'Triggers' and 'Actions'? Or are you using Macro instead of Actions?

The problem I have is that the selections to the other field doesn't work if the =GETFIELDSELECTIONS("FieldName") function returns multiple selections. It only works if there is only one value selected.

Is it also the case on your QlikView application?

Thanks for the answer.

Lifiester

Not applicable
Author

Lifiester,

I am using triggers and actions. From my understanding, triggers and actions are a graphic front end for writing macros? If you go to edit module, you'll see the code behind the triggers and actions you created.

You brought a very good point though, and my program only works for one field selection as well. I have the department set to always to select one field value, and don't require the multiple department selection. However, I'll gladly do some more testing to see if I can get it to work with multiple selections as well.

ttyl.

Not applicable
Author

Hi,

I also saw another strange thing. Are you only using this for one field? (I mean only for "Department" field forcing another field).

Because I have like 3 fields, for example: FieldA triggering Field1, FieldB triggering Field2, and FieldC triggering Field3.

Normally if you select one value on "Department" field, you will get the same selection on the other field, and if you unselect the value on "Department" field, the value on the other field will also be unselected. Right?

If you select one value on each field (on FieldA, FieldB, and FieldC), the corresponding value on Field1, Field2, and Field3 will be selected. But then, if you unselect the value on one of the fields (lets take the value on FieldA), the corresponding value on Field1 is not unselected. So the value on Field1 is still selected like it was.

Have you tried this situation, Chhai Sun?

Thanks for the response.

Not applicable
Author

Lifiester,

I'm replying only to confirm your old suspicious. The unselect doesn't work. I'm facing this problem right now.