Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to use if condition in a straight table / text object to display images as follows:
(value<40%), display green color
(value>40%) and (value<70%), display yellow color
(value > 70%), display red color
The only problem is that it does not display red color, instead display only green and yellow color.
I have used the following expression. Probably it needs some modification. Can somebody please suggest?
=if((value<40),'qmem://<bundled>/BuiltIn/led_g.png',
if((value>41)&(marks1<70),'qmem://<bundled>/BuiltIn/led_y.png',
'qmem://<bundled>/BuiltIn/led_r.png')
)
Regards & Thanks,
- Khaled
Hi,
In your sample there are only marks1 70, 90, and 100
and since this is your requirements:
(value<40%), display green color
(value>40%) and (value<70%), display yellow color
(value > 70%), display red color
then your display will always be red^^
all you need to do is replace '&' from your expression to 'AND'
like this,
=if((value<40),'qmem://<bundled>/BuiltIn/led_g.png',
if((value>39) and (marks1<70),'qmem://<bundled>/BuiltIn/led_y.png',
'qmem://<bundled>/BuiltIn/led_r.png')
)
Regards,
Alex
Hi Khaled,
This expression is working
=if((marks1<40),'qmem://<bundled>/BuiltIn/led_g.png',if(((marks1>=41)and marks1<=70)),'qmem://<bundled>/BuiltIn/led_y.png','qmem://<bundled>/BuiltIn/led_r.png'))
PLease try it and let me know
Thanks.
Sup
The "marks1>=41" part of this expression is not necessary. IF() will stop at the first true condition, so if the "marks1<40" is false then it must be >=41...
=if((value<40),'qmem://<bundled>/BuiltIn/led_g.png',if((value<70),'qmem://<bundled>/BuiltIn/led_y.png','qmem://<bundled>/BuiltIn/led_r.png'))
Hope this helps,
Jason
Hi,
In your sample there are only marks1 70, 90, and 100
and since this is your requirements:
(value<40%), display green color
(value>40%) and (value<70%), display yellow color
(value > 70%), display red color
then your display will always be red^^
all you need to do is replace '&' from your expression to 'AND'
like this,
=if((value<40),'qmem://<bundled>/BuiltIn/led_g.png',
if((value>39) and (marks1<70),'qmem://<bundled>/BuiltIn/led_y.png',
'qmem://<bundled>/BuiltIn/led_r.png')
)
Regards,
Alex
Hi Supthigale, Thank you for your response.
Slightly modified the expression and it works fine now. Here it is: =if((marks1<40),'qmem:///BuiltIn/led_g.png', if(((marks1>=40)and (marks1<=70)),'qmem:///BuiltIn/led_y.png', 'qmem:///BuiltIn/led_r.png'))
Thanks, - Khaled