Focal Point
[CLOSED] Traffic LIghts

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

October 27, 2017, 04:57 PM
BSBAL18
[CLOSED] Traffic LIghts
I have a simple report with 2 columns, i set up a traffic light condition as Column 1 does not equal column2. When this is the case (the row value for Col1 <> row value for col2) i want the font to be red for that column. I cannot find this "column font red" option, i can turn the whole ROW red, but thats not what i want, as future col3 and 4 might be ok... Am i understanding traffic lights correctly? MY end goal is "col1 <> col2" row data....turn font red.

This message has been edited. Last edited by: BSBAL18,


AS Version: 8201
Gen: 10202016
Windows, All Outputs
October 28, 2017, 04:30 AM
OPALTOSH
Which column do you want to be red when col1<>col2?
Can you include your code so we can see how the report is being created. That will determine how you code the style sheet option to do what you want.
It may be easier to include a COMPUTEd field that is 1 or 0 depending on the comparison between your to columns. You can then use this field in the WHEN clause of the style sheet line. You can add a NOPRINT so that it is not displayed in the report.
October 28, 2017, 05:06 PM
BSBAL18
You can see the nearly identical field names. Each "compare" has 3 fields, one is current setting (end in S), one is "should be setting" (end in M) and the last is a compare that has a 1 or null (ends in C) to tell me if that field comparison was = or not =. To your questions, i want BOTH the M and S fields to be red font. You said i could use the C (compare) field to help, and i do have it.

TABLE FILE WFX_SETTINGS_COMPARE
BY WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DIV_DESCS
BY WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.SITE_ALIASS
BY WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.FLCTR_DESCS
BY WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DEFAULT_UNITSS
BY WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DEFAULT_UNITSM
BY LOWEST WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DEFAULT_UNITSC
BY LOWEST WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DRIVE_TIME_MINSS
BY LOWEST WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DRIVE_TIME_MINSM
BY LOWEST WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DRIVE_TIME_MINSC
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/enwarm.sty,
$
ENDSTYLE
END


AS Version: 8201
Gen: 10202016
Windows, All Outputs
October 29, 2017, 05:33 AM
OPALTOSH
The comparison field should be a COMPUTE not a DEFINE.

It would be really useful to see the DEFINE code and a sample of the actual output.

The stylesheet line will be something like
TYPE=DATA,COLUMN=WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DIV_DESCS,COLOR=RED,WHEN=WFX_SETTINGS_COMPARE.WFX_SETTINGS_COMPARE.DRIVE_TIME_MINSC EQ 1,$
October 30, 2017, 08:13 AM
MartinY
quote:
The comparison field should be a COMPUTE not a DEFINE.

Sorry OPALTOSH, but this is not true. You may need the comparison to be done in a DEFINE. In some cases it could have to be done there.

More detail from BSBAL is needed such has is complete code.

Consider these two samples

-* Sample -1-
-* In this one Italy & W Germany have either SAME or DIFF value in CMP field
TABLE FILE CAR
SUM COMPUTE CMP/A4 = IF BHP NE RPM THEN 'DIFF' ELSE 'SAME';
BY COUNTRY
BY MODEL
BY BHP
BY RPM
END


-* Sample -2-
-* In this one Italy & W Germany only have DIFF value in CMP field
TABLE FILE CAR
SUM COMPUTE CMP/A4 = IF BHP NE RPM THEN 'DIFF' ELSE 'SAME';
BY COUNTRY
END


My point is to show that depending of what your have in your query and what is your expected result, a comparison in a COMPUTE may not always be the proper place.

And if you look at that sample, you will see that W Germany display DIFF as from the COMPUTE and SAME as for the DEFINE. Changing the SUM for a PRINT also change the result. And all this also depend on the BY fields used.
DEFINE FILE CAR
CMP_DEF/A4 = IF BHP NE RPM THEN 'DIFF' ELSE 'SAME';
END
TABLE FILE CAR
SUM COMPUTE CMP/A4 = IF BHP NE RPM THEN 'DIFF' ELSE 'SAME';
    CMP_DEF
BY COUNTRY
END


PRINT display each values once the WHERE clause are applied.
SUM display aggregated values once the WHERE clause are applied.

COMPUTE works with internal matrix data (basically once WHERE clause and SUM are applied), when DEFINE works with source data (before WHERE clause).

This message has been edited. Last edited by: MartinY,


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
October 31, 2017, 04:31 AM
OPALTOSH
With respect I am aware of all that having been writing FOCUS code for more than 30 years.
Of course it could require a COMPUTE or a DEFINE but without further information it is impossible to tell.
The main point was that they need a field (however and whenever it is calculated) to be available for use in the Stylesheet's WHEN clause for the column that needs to be styled.

There is just not enough detail from the questioner to be specific about the solution that will work for them.
October 31, 2017, 08:59 AM
MartinY
quote:
With respect I am aware of all that having been writing FOCUS code for more than 30 years.


Sorry if I've offended you, it was not my intention.

quote:

to be available for use in the Stylesheet's WHEN clause for the column that needs to be styled.


"MACRO" can also be useful to style a row and/or column since it may need less repetitive coded condition.
With WHEN you need to repeat the condition every where, with MACRO you define once.
But both can be use and sometime one is better then the other.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
November 01, 2017, 08:26 PM
OPALTOSH
Having a discussion between us is not really helping the questioner.
If he really wants some help he/she needs to show us some more code and explain in more detail what he/she is trying to achieve.
Whether he/she uses MACRO is not really relevant yet. There are always multiple ways of doing this but at this stage we don't really know what they want let alone be in a position to show them how to do it.