Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
apthansh
Creator
Creator

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
MarcoWedel

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
swuehl
MVP
MVP

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

eduardo_dimperio
Specialist II
Specialist II

Hi Ansh,

The problem is the bracket []. Just remove

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

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

apthansh
Creator
Creator
Author

tried..but doesnt work

eduardo_dimperio
Specialist II
Specialist II

What happen? print the message pls

vishsaggi
Champion III
Champion III

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

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

Capture.PNG

MarcoWedel

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
Creator
Creator
Author

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
Champion III
Champion III

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

MarcoWedel

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