on 07-16-2007 3:26 PM
In the use of embedded lights, the value inside the lights is the value returned from the sql query. I want to hard code a value of C inside the light but drive the color of the light off the results of the sql query. Is there a way to do this?
B.J.,
I would use a CASE statement like this:
SELECT (CASE WHEN MyColumn < 50 THEN '<R>' ELSE '<G>' END) AS MyStatus FROM MyTable
Then in the Display Template use String match mode to color context the MyStatus column for Green <G> and Red <R>
Regards,
Jeremy Good
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Embedded Lights mode shows the single letter that falls between the < > symbols, and was originally intended for addressing the prevalant red/green color-blind concerns (as evidenced in my example). It also color contexts based upon this, so using this mode you can't have the letter C jammed into the lights unless you color it accordingly.
I haven't tried this before, but maybe use upper case <C> for Red and lower case <c> for Green?
Regards,
Jeremy
Dear Jeremy,
I am trying to do the same as you have in your examples. The following select statement works for MySQL DB,
SELECT devicename, data01, oname, CASE data01 WHEN 'off' THEN '<R>' ELSE '<G>' END FROM events ORDER BY timestamp01 DESC LIMIT 15;
I tried in the fixed query on the BLS and it gives me the correct output with <G> values substituted in the column.
In the color context, substituting the <G> with a color produces a traffic light with the color of choice.
Then I tried
SELECT devicename, data01, oname, CASE data01 WHEN 'off' THEN '<R>' WHEN 'No_WP' THEN '<Z>' ELSE '<G>' END FROM events ORDER BY timestamp01 DESC LIMIT 15;
does give a query result. Then I used the Color Context and added a row with a color of my choice and under the status column I had <Z> matched for this new color.. viola..it works !
Cheers
Domnic
Edited by: domnic savio on Apr 20, 2008 1:10 AM
Edited by: domnic savio on Apr 20, 2008 1:17 AM
User | Count |
---|---|
11 | |
6 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.