Book a Demo

Author Topic: Conditional formatting  (Read 4125 times)

robbierzzz

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Conditional formatting
« on: May 11, 2009, 09:38:22 pm »
Hi there,

I'm searching for a feature for conditional formatting in EA. I want to give certain elements a kind of 'label' (maybe Tagged Value fits in this context?)  and  then give these elements a certain background color. This feature would spare me loads of clicks ;). Does anyone know wheter this feature is covered by EA?

Thanks in advance!
Dance with the stars

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Conditional formatting
« Reply #1 on: May 11, 2009, 11:34:58 pm »
Try a shape script. You would need to stereotype the elements, but the formatting should work.
No, you can't have it!

bioform

  • EA User
  • **
  • Posts: 230
  • Karma: +0/-0
  • Forty-Two?
    • View Profile
Re: Conditional formatting
« Reply #2 on: May 12, 2009, 01:34:20 am »
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
}
================================
« Last Edit: May 12, 2009, 01:34:47 am by bioform »
Time is what keeps everything from happening at once, Space is what keeps it all from happening to you. <unknown>

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Conditional formatting
« Reply #3 on: May 12, 2009, 09:57:13 am »
This isn't what you've asked for, but it may be helpful.

There is a toolbar called the format tool.  It applies formatting to the current object on a single diagram only.  But it also allows you to copy styles from one object to another.  Even saving named styles that you can re-use.

If what you are wanting is the coloring, this may be the easiest way to do that.