PDA

View Full Version : Colour Rule


Kingsfield
November 13th, 2008, 08:48 AM
Hi Again,

I have to assign colour to 3 more variables, the current script works fine for 2 variables in the column, however we need to add 3 more variables.
if (ToLower(parts[0]) == "kitten")
format = "<color name=Blue>"+"Kitten:";
and
if (ToLower(parts[0]) == "Puppy")
format = "<color name=Green>"+"Puppy:";

if (ToLower(parts[0]) == "ferret")
format = "<color name=Black>"+"Ferret:";

Please see the script below that works for the 2 variables.
I need help :confused: :confused:

var fieldval = NormalizeEntities(Field("Sample 1 For Export"));
var parts = fieldval.split(":");
if (parts.length < 2)
return fieldval;

var format = "";
if (ToLower(parts[0]) == "cat")
format = "<color name=Red>"+"Cat:";
else
format = "<color name=Black>"+"Dog:";

return format + parts[1];