Yes I also do something like this...
My shapscript for UC's checks for the value of the UC['s tagged field and then sets the Background color based on the value (e.g., Red, Yellow, Green)
Here is a sciprt fragement that might help you... David
================================
// Author - David Rains (
[email protected]) Copyright 2009
// Release:
//
// Script Version: 1.0
// Script's Purpose: ... Set background color based on precision values...
Shape Main
{
//Default Property Initializations
noShadow = "false";
dockable = "none";
//Stereotyped Derived Settings
//Adorment - FillColorByPrecision
//check for Any Missing Precision FlaggedValues
If(hastag("Precision"))
{
IF(hastag("PrecisionTarget"))
{
//Check if Precison is N/A
if(hastag("PrecisionTarget","N/A"))
{
SetFillColor(255,255,255); //RGB - White
}
if(hastag("Precision","N/A"))
{
SetFillColor(255,255,255); //RGB - White
}
//Determine Fill Color by Precision
if(hastag("Precision","0"))
{
SetFillColor(255,0,0); //RGB - DarkRed
}
if(hastag("Precision","1"))
{
SetFillColor(255,128,128); //RGB - LightRed
}
if(hastag("Precision","2"))
{
SetFillColor(255,255,0); //RGB - LightYellow
}
if(hastag("Precision","3"))
{
//If at 3 and Informal, then target met so DarkGreen
if(hastag("PrecisionTarget","Informal"))
{
SetFillColor(0,128,0); //RGB - DarkGreen
}
//If at 3 and Formal, then target not yet met so LightGreen
if(hastag("PrecisionTarget","Formal"))
{
SetFillColor(128,255,0); //RGB - DarkGreen
}
}
if(hastag("Precision","4"))
{
SetFillColor(0,128,0); //RGB - DarkGreen
}
}
}
//Draw Shape
DrawNativeShape();
//Stereotyped Static Adornments
}
================================