hexagon logo

Customizing Report Colors

I recently ran into a thread here where a user was asking to make a header Trace Field have conditional text coloring. I was messing around with reports, trying to find a way to customize a color for them, and I remembered reading how you can change comment colors using this here :
https://docs.hexagonmi.com/pcdmis/2019.1/en/helpcenter/mergedProjects/core/24_report_topics/Inserting_Programmer_Comments.htm

First Method:

1. Shift + F6 while in Edit Window
2. Select the "File Header" field
3. Change Marked (~~1 color) or Unmarked (~~2 color) to Green and when it asks to "Do you want to change the values for this item's children?" Select "Yes"

To edit header label go to : File > Reporting > Edit > Label Template > "FILE_HEADER.LBL"
4. In header Label
= "OUT OF TOLERANCE : " + VARIABLE("V2")
Replace Variable with whichever variable you prefer. Sample code below.

ASSIGN/V1=GETPROGRAMINFO("NUMOOT")
ASSIGN/V2="~~2 " +V1
IF/V1>0
ASSIGN/V2="~~4 " + V1
END_IF/


Second method:
After playing around with RGB codes and report labels, I've worked out how to fully customize full RGB coloring into the label fields. Without needing to modify colors in the Color Editor (Shift + F6)
1. Add this bit of Code to any program.
$$ NO,
            Green
ASSIGN/V1=GETPROGRAMINFO("NUMOOT")
ASSIGN/RGB1=0
ASSIGN/RGB2=255
ASSIGN/RGB3=0
IF/V1>0
  $$ NO,
              Pink
ASSIGN/RGB1=255
ASSIGN/RGB2=204
ASSIGN/RGB3=255
END_IF/​​


Before modifying any report labels, be sure to save a backup original set of copies to replace any you change.

To edit header label go to : File > Reporting > Edit > Label Template > "FILE_HEADER.LBL"

2. In any cell on the header Label
= "OUT OF TOLERANCE : " + RGB(VARIABLE("V1"),VARIABLE("RGB1"),VARIABLE("RGB2"),VARIABLE("RGB3"))


3. Replace any of the above RGB assign statement Values with your appropriate RGB Color Code​.

There may be easier ways, or even better ways of doing this, but I could not find too much information on modifying reports aside from help files.

Attached Files
Parents Reply
  • Reporting things can be difficult at times.

    This will check the number out of tolerance, if there are some the first RGB method will be used, if not the second RGB will be used.
    This will color the entire string. Changing the background color would need more thought as a script on the label will most likely be needed.


    =IF(NUMOUTTOL ()>0, RGB("Dimensions Out Of Tolerance=" + NUMOUTTOL(),0,0,255), RGB("Dimensions Out Of Tolerance=" + NUMOUTTOL(),0,255,0))
Children
  • Was looking back as this and was using this line of code, and it turned my full text to green, so I modified it a tad to make it just colorize the "NUMOOT" quantity.

    BEFORE CHANGES -- Color full line of text
    
    =IF(NUMOUTTOL ()>0, RGB("Dimensions Out Of Tolerance=" + NUMOUTTOL(),0,0,255), RGB("Dimensions Out Of Tolerance=" + NUMOUTTOL(),0,255,0))
    
    AFTER CHANGES -- Color quantity only
    
    =IF(NUMOUTTOL ()>0, "Dimensions Out Of Tolerance=" + RGB(NUMOUTTOL(),0,0,255), "Dimensions Out Of Tolerance=" + RGB(NUMOUTTOL(),0,255,0))

    Replace text above "Dimensions Out Of Tolerance=" with your desired text.