Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
dena_reavis
Employee
Employee

Field used in condition getting selected with Dimension

Greetings Experts,

I have a data set with a record that indicates whether the Dimension Value should be indented and I also use that to shade the background color. The curious thing is that when the dimension is selected in the chart by the user, the RecType field is getting selected with it - and I don't want it to. What can I do to work around this? It is confusing my users.

RecType in Color and Indent.png

The only thing this is for is indenting the Department Name on certain rows and I use it for the row background color for each dimension. However, only the Department is being affected, it seems because it is the only field where the RecType is part of the Dimension Expression - in that IF statement that adds spaces to the Department if the RecType is = 2. Only the RecType 2 rows are green.

Indented Result.png

If they just click on a Department, it is also filtering on the RecType, shown below in the current selections. RecType in Selection.png

Any suggestions for keeping the RecType from being selected too?

Thank you!

9 Replies
sunny_talwar

I am afraid there might not be much you will be able to do on the front end... but you can try the same in the script

If(RecType = 2, '          ' & DepartmentDSC, DepartmentDSC) as NewDepartmentDSC

and now use NewDepartmentDSC as your dimension....

dena_reavis
Employee
Employee
Author

This is awesome!

Here is a follow up question. How do I set a trigger to select the values in DepartmentDSC when the user clicks in the chart on a field that is actually NewDepartmentDSC?

sunny_talwar

May be something like this

Field

DepartmentDSC


Search String

Trim(NewDepartmentDSC)

dena_reavis
Employee
Employee
Author

This works but when I select the NewDepartmentDSC, the DepartmentDSC is also being selected and shows in the current selections. Is there a trigger that can select DepartmentDSC in place of the selection for NewDepartmentDSC?


I tried Toggle Select in both the "OnSelect" and "OnChange" both have the same shown here:toggle select.png


It seems to work perfectly for the OnChange but the initial OnSelect also selects the following:

Current selection after toggle select.png

What can I do differently to make it only select the DepartmentDSC (Also sorry I actually named the filed IndentedDepartmentDSC instead of NEW.

thank you for your help!!

sunny_talwar

You can create NewDepartmentDSC as a hidden field which would not show up in current selection box

SET HidePrefix = %;

If(RecType = 2, '          ' & DepartmentDSC, DepartmentDSC) as %NewDepartmentDSC

now on the front end, replace all NewDepartmentDSC with %NewDepartmentDSC

dena_reavis
Employee
Employee
Author

thank you! One last thing is that it selects correctly from the chart but in the current selections box, I can't clear that selection from there. I click on the eraser and nothing happens. Have I unintentionally locked the field? I checked to make sure there are no other triggers on this field %NewDepartmentDSC.

sunny_talwar

That's strange... would you be able to share a sample to look at this?

dena_reavis
Employee
Employee
Author

I'm sorry, I can't post this.

sunny_talwar

Then I have no idea what might be wrong here