July 25, 2006, 09:43 AM
RaydenSpeific Cell Coloring
Hi All,
I am trying to hightlighg a specific cell based on conditional logic and it works, kinda. The problem is when the column in question is used as a BY value in the report definition, the conditional formatting gets applied to all the cells in the group regardless of whether there is data present. Here is my CAR example fex:
-* File colortest2.fex
TABLE FILE CAR
PRINT
COUNTRY NOPRINT
SALES
BY COUNTRY
BY CAR
BY MODEL
WHERE (SALES GT 0);
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
UNITS=IN,
PAGESIZE='Legal',
LEFTMARGIN=0.000000,
RIGHTMARGIN=0.000000,
TOPMARGIN=0.000000,
BOTTOMMARGIN=0.000000,
SQUEEZE=ON,
ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
COLOR='BLACK',
STYLE=NORMAL,
RIGHTGAP=0.125000,
TOPGAP=0.013889,
BOTTOMGAP=0.027778,
$
TYPE=DATA,
FONT='LUCIDA SANS',
JUSTIFY=CENTER,
$
TYPE=DATA,
COLUMN=N2,
BACKCOLOR=GRAY,
WHEN=N2 EQ 'ALFA ROMEO',
$
ENDSTYLE
END
When you run this you will see it sets the back color of the model column to gray where the model is ALFA ROMEO, however as there are multiple rows for this BY value it ends up coloring all the cells gray. I only want the cell with the words ALFA ROMEO in it to be affected.
Is anyone aware of a technique to achieve this?
As always any insight you guys can offer will be greatly appreciated.
Thanks,
Rayden.
July 25, 2006, 10:15 AM
PeteHi,
You can try it this way
TABLE FILE CAR
PRINT
COUNTRY NOPRINT
SALES
COMPUTE V_CAR/A20=IF CAR EQ LAST CAR THEN '' ELSE CAR; NOPRINT
BY COUNTRY
BY CAR
BY MODEL
WHERE (SALES GT 0);
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
UNITS=IN,
PAGESIZE='Legal',
LEFTMARGIN=0.000000,
RIGHTMARGIN=0.000000,
TOPMARGIN=0.000000,
BOTTOMMARGIN=0.000000,
SQUEEZE=ON,
ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
COLOR='BLACK',
STYLE=NORMAL,
RIGHTGAP=0.125000,
TOPGAP=0.013889,
BOTTOMGAP=0.027778,
$
TYPE=DATA,
FONT='LUCIDA SANS',
JUSTIFY=CENTER,
$
TYPE=REPORT,
COLUMN=CAR,
BACKCOLOR=GRAY,
WHEN=V_CAR EQ 'ALFA ROMEO',
$
ENDSTYLE
END
Hope it helps,
P.
July 25, 2006, 10:24 AM
RaydenHi Pete,
That is perfect, thanks. So if I use a virtual field for the comparisons it works but using the Data Column value it does not. That is what I needed to know.
Thanks again for the fast and accurate response!!
Rayden.