Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Highlight current selection within straight table chart

Hi everyone,

I have a static straight table chart which (a) ignores the current selections but (b) highlights the row in the table which matches the Current Selection. This works fine when only a single item is selected but I need this to be able to work for multiple selections for the dimension.

For example:

- A user selects "Joe Smith" as the EmployeeName

- The straight table chart shows all records regardless of the selected EmployeeName

- The row where EmployeeName = "Joe Smith" is highlighted in the straight table chart by setting text format based on GetFieldSelections(EmployeeName)

I need to be able to do the following:

- A user selects multiple values "Joe Smith", "Beth Green" and "Bob White" of EmployeeName

- The straight table chart shows all records regardless of the selected EmployeeName

- ALL rows where EmployeeName = any of the selected values need to be highlighted.

I would appreciate some help on how I can achieve this.

Thanks in advance

Craig

1 Solution

Accepted Solutions
swuehl
MVP
MVP

At my place, increasing the maxnumber of GetFieldSelection worked just fine:

=if(wildmatch(GetFieldSelections([EmployeeName],',',100),'*'&only({1} [EmployeeName])&'*' ),'<b>')

On what QV version are you?

View solution in original post

8 Replies
swuehl
MVP
MVP

Instead of using something like EmployeeName = 'Joe Smith' (which is assumingly the result of a condition like EmployeeName = GetFieldSelections(EmployeeName), try a wildmatch:

=if( Wildmatch( GetFieldSelections(EmployeeName), '*'&EmployeeName&'*'), yellow() )

Hope this helps,

Stefan

Not applicable
Author

Thanks swuehl.

I tried that syntax but it highlights all records regardless of which EmployeeNames are selected.

I use the current statement to highlight a record in bold but this only works if a single Employee is selected:

=if(EmployeeName = (GetFieldSelections(EmployeeName)),'<B>')

Regards,

Craig

swuehl
MVP
MVP

Just tried it and to my surprise, all dimension values were highlighted, as you said.

I got it working like this (on QV10SR2):

=if(wildmatch(GetFieldSelections([EmployeeName]),'*'&only({1} [EmployeeName])&'*' ),'<b>')

Note that if you select more than 6 values at a time, you might need to increase the maxvalues shown separately in GetFieldSelections passing the max value as third parameter.

Hope this helps and works out,

Stefan

Not applicable
Author

Thanks and apologies for the delayed response...due to internet connectivity issues.

I tried your updated code and set the maxvalue to (a) the number of selected items with the GetSelectedCount and also (b) manually to a value of 10 but there seems to be some internal limit around more than 6 values.

I would appreciate it if you had any other suggestions otherwise I will set display calculation to 6 or less in order to work around this limit.

Regards,

Craig

swuehl
MVP
MVP

At my place, increasing the maxnumber of GetFieldSelection worked just fine:

=if(wildmatch(GetFieldSelections([EmployeeName],',',100),'*'&only({1} [EmployeeName])&'*' ),'<b>')

On what QV version are you?

Not applicable
Author

Thanks and that worked perfectly. School boy error on my part as I put the maxvalue in the wrong place!!

Regards,

Craig

udaya_kumar
Specialist
Specialist

hi stefan,

where i need to put that expression to highlight the row?

udaya_kumar
Specialist
Specialist

Hi stefan,

thanks for the expression,

i tried it by using it in background color for my requirement, so its working fine

thanks