ODBiC Discussion Board

RE: Different Colors For Different Groups of Records, Dave, 11-03-2005

Just test the value of the ID field

by Roger Harris, November 3, 2005 17:20

The IF statement will do it (e.g. ), but the $if(...) function is a little more compact when all you need to do is output a short piece of text. The $if(...) function takes three arguments: a condition to test; a value to output if the condition is true; and a value to output if the condition is false. If you have more than two values to test, you can "nest" additional $if(...) functions in the "false" argument, and those nested functions can also have more $if(...)s nested in them if necessary. For example, if the only choices are Red, Blue, and Yellow, then this will work (using whatever hex values you actually want):

This statement means that if the value of variable $ID$ is "Red", then #FFCCCC will be output. Otherwise the third argument is output, but it's also an $if(...): if the value of $ID$ is "Blue", then #CCCCFF is output. Otherwise the third argument to that function is output, #FFFFCC (but that could be another $if(...) if you needed another test, and so on). Just remember to give each $if(...) exactly three arguments separated by commas, and to close all the open parentheses at the end.


Post Your Reply:

E-mail  optional

HTTP Link: 
Link text: 

Copyright 1997-2003, Roger Harris. All rights reserved.