Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I am trying to set a traffic light based on a value of a particular field. The field is a status field. It has 3 possible values. I would like the traffic light displayed green, yellow or red depending on the value of the field (text value). I have searched the forums and tried over and over to get this to work.
Can someone please explain something from begining to end. I'm assuming I must use a table chart. I tried this and couldn't get it to work. It's basically a report that's displayed and I want the last column to display a traffic light based on one of the fields value (remember it's a text value like ONTIME, LATE and NOTDELIVERED). ONTIME = green, LATE = red and NOTDELIVERED = yellow (all traffic lights.
Please help!
See attached example. Basically, you put in the 1, 2 and 3 as the segment boundaries, and set the color for each segment appropriately.
You can do this several ways including changing texts and background colours but I think what you are after are the bundled images that mimic traffic lights.
Yes you need a chart of some sort (pivot or table) then create an expression like this :
if (fieldname='good', 'qmem://<bundled>/BuiltIn/led_g.png', if (fieldname='notsogood', 'qmem://<bundled>/BuiltIn/led_o.png', 'qmem://<bundled>/BuiltIn/led_o.png'))
This represents a compound conditional statement like this:
if fieldname = 'good' then
show green traffic light
else if fieldname = 'notsogood'
show orange traffic light
else
show red traffic light
Remember to change the 'display options' under the expressions tab on the'chart properties' to representation = 'image'.
Hope that helps,
Gordon
I'd probably make your status field a dual() field:
dual(Status,match(Status,'ONTIME','NOTDELIVERED','LATE')) as Status
While you will still normally see Status as text, it then also has an underlying value of 1, 2 or 3. That allows you to set up a traffic light for the field just like you would for any other numeric field.
Hi John, I used the function you mentioned and for the first time got past 'Error in expression' message. Now, where do I put the Ontime = 1 and green traffic light, notdelivered = 2 and yellow traffic light and late= 3 red traffic light?
I put in Representaiton - Traffic Light Guage. Then go into Guage settings and don't know what to put here.
Can you please help? I've been on this all day.
Thank you!
See attached example. Basically, you put in the 1, 2 and 3 as the segment boundaries, and set the color for each segment appropriately.
Thanks John. That's just what I needed. Regards.