Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

GetCurrentField() function for all dimensions in the cycle group

Hello,

I'm trying to assign color mappings to different dimensions (Entity, Attribute and GenericRule) in the cycle group in a bar chart in Qlikview. I created mapping tables for all dimensions e.g.

Mapping LOAD
Attribute,
RGB(Red,Green,Blue) AS AttributeColor

(same for Entity and GenericRule)

I then used ApplyMap function to read them in:
LOAD
Attribute,

ApplyMap ('AttributeColorMap', Attribute, LightGray()) AS AttributeColor,

(same for Entity and GenericRule)

In Chart Properties -> Expressions under Background Color I put the following script, however I'm getting "Error in expression". Can someone please advise what I'm doing wrong here?

=if(GetCurrentField([Rules Dim Group])='Entity','EntityColor',
(if(GetCurrentField(
[Rules Dim Group])= 'Attribute','AttributeColor')),
(if(GetCurrentField(
[Rules Dim Group])='GenericRule','RuleColor')),
cdbAmber)

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You want the value of the entity color field, not the text 'EntityColor'. Also the bracketing needs to be revised:

=if(GetCurrentField([Rules Dim Group])='Entity', EntityColor,
if(GetCurrentField(
[Rules Dim Group])= 'Attribute', AttributeColor,
if(GetCurrentField(
[Rules Dim Group])='GenericRule', RuleColor, cdbAmber)))

View solution in original post

3 Replies
swuehl
MVP
MVP

You want the value of the entity color field, not the text 'EntityColor'. Also the bracketing needs to be revised:

=if(GetCurrentField([Rules Dim Group])='Entity', EntityColor,
if(GetCurrentField(
[Rules Dim Group])= 'Attribute', AttributeColor,
if(GetCurrentField(
[Rules Dim Group])='GenericRule', RuleColor, cdbAmber)))

Anonymous
Not applicable
Author

That worked perfectly. Thank you!

swuehl
MVP
MVP

Another option could be a pick/ match combination


=Pick(

Match(GetCurrentField([Rules Dim Group]),'Entity','Attribute','Generic Rule')+1,

cdbAmber, //default value first

EntityColor,
AttributeColor,
RuleColor

)