Focal Point
Conditional Formatting?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9151058331

April 28, 2005, 06:28 PM
Ginny
Conditional Formatting?
I have a column that I want to show the data in only if the data in another column is equal to something.

Such as Column1 data should appear only if Column2 is equal to a certain value. Otherwise the data should not appear in column1 on the report.

I've tried doing this with condition through report painter. It says Column2 is equal to Value, but there doesn't seem to be an option that says only show when...column2 is equal to value.

What am I missing?
April 28, 2005, 06:53 PM
Francis Mariani
You need to create a defined or computed field to do this, something like:

SALESX/P8 = IF DATE GT '20040101' THEN SALES ELSE 0;

Display SALESX in the report and not SALES.
April 28, 2005, 06:54 PM
susannah
Ginny, that's probably best done with a DEFINE, where you set a value for field1 if field2 >0 else 0;
and format field1 to supress zero , /I8S , for example.
If you're in html, you can conditionally change the color of field 1 to white based on some WHEN= in the style sheet...but that's really cheating Razzer
April 29, 2005, 05:47 AM
Goldy
Hi Ginny,

Try following code may be useful for you...

DEFINE FILE Tablename
col3/I10=IF COL2 EQ COL1 THEN COL1 ELSE 0;
END

TABLE FILE Tablename
PRINT
ITEM
col3
COL2
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
END
April 29, 2005, 10:24 PM
N.Selph
I've done a similar conditional formatting, making the column text white unless it fits the condition. In that case you wouldn't need a defined field.
May 02, 2005, 04:03 PM
Boogarweed
I agree with N.Selph. For example, if we know that all non-sedans in the car database have two seats we might write the code below to change the color of the text to match the background giving the effect of blanking it out. Try it out.

TABLE FILE CAR
PRINT CAR MODEL BODYTYPE SEATS
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SEATS, COLOR=WHITE, WHEN=BODYTYPE NE 'SEDAN', $
ENDSTYLE
END