Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
apthansh
Contributor

Expression

if(Region='EMEA','c:/Red.png',

if([Region]='APAC','c:/green.png'))

This expression is not working in a default view in straight table where as it changes the image when I select that particular region.Any idea ?

Thanks much.

1 Solution

Accepted Solutions

Re: Expression

Hi,

you might use this expression in a context where [Region] delivers more than one value, i.e. the default aggregation function "only()" returns a null value. Only when selecting a specific region, one of the conditions is fulfilled and your expression returns an image path.


See also:


It’s all Aggregations


Use Aggregation Functions!


The Only Function


The Aggregation Scope



hope this helps


regards


Marco

View solution in original post

9 Replies
MVP
MVP

Re: Expression

Not sure what you are talking about. Could you post a small sample QVW that demonstrates the issue?

eduardo_dimperio
Valued Contributor II

Re: Expression

Hi Ansh,

The problem is the bracket []. Just remove

if(Region='EMEA','c:/Red.png',

if(Region='APAC','c:/green.png'))

apthansh
Contributor

Re: Expression

tried..but doesnt work

eduardo_dimperio
Valued Contributor II

Re: Expression

What happen? print the message pls

vishsaggi
Esteemed Contributor III

Re: Expression

Did you change the representation in Expression tab to Image. Like:

= Pick(Match(Region, 'EMEA', 'APAC') , 'c:\Red.png', 'c:\green.png'))

Capture.PNG

Re: Expression

Hi,

you might use this expression in a context where [Region] delivers more than one value, i.e. the default aggregation function "only()" returns a null value. Only when selecting a specific region, one of the conditions is fulfilled and your expression returns an image path.


See also:


It’s all Aggregations


Use Aggregation Functions!


The Only Function


The Aggregation Scope



hope this helps


regards


Marco

View solution in original post

apthansh
Contributor

Re: Expression

Thank you.Only() function  works but I also wanted to try the below method.Is there anything wrong in the below expression ?just as a back up as I am applying this to API.

=if(GetSelectedCount([Region])='EMEA', 'c:\Red.png','c:\Red.png' AND

IF(GetSelectedCount([Region])='APAC','c:\yellow.png', 'c:\yellow.png' AND

IF  (GetSelectedCount(Region])='AMER', 'c:\green.png', 'c:\green.png')))

Thank you much

vishsaggi
Esteemed Contributor III

Re: Expression

Ansh, GetSelectedCount() returns an integer so may be use GetFieldSelections([Region]).

Re: Expression

glad it worked.

Can you please post some sample data and your expected result for this expression, as using AND as a string operator seems a bit odd?

thanks

regards

Marco