Focal Point
[CLOSED] Dynamic conditional formatting?

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

May 23, 2017, 10:35 AM
Jason-1
[CLOSED] Dynamic conditional formatting?
Hoping someone can help or point me in the right direction. Let's say I have a grid with a category as the row, a date as the column, and some value:

Category Month 1 Month 2 Month 3 Etc
-------- ------- ------- -------
Category A 1234 0 0
Category B 0 2345 3456
Category C 0 0 0
(edit - sorry, this grid didn't display in the message the way it does in the editor, not sure how to fix but I think you get the idea).

Easiest way I can describe what I am thinking of is Excel.. you highlight the values and turn on conditional formatting. The formatting can be tied to whatever the values are.

In Webfocus I've been searching and the only way I can see to do formatting of cells is in the styling, and would be to style the sheet based on hard-coded values or based on comparing to some other cell.

Is there some relatively easy way in webfocus to to just color/style cells in a grid based on all the values displayed -- i.e. higher value cells are darker, lower value cells are lighter, 0's are white?

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8009
May 23, 2017, 11:14 AM
MartinY
Hi Jason,

First to have your sample properly displayed enclose with the code tag, most right icon :
</>
in the option ribbon of the discussion editor and place your text between the two tags.

Second :
Search in the Knowledge Base for : DEFMACRO. It could be a way to do it. You will then end up with topics on styling with macros.
Search in the Knowledge Base for : when clause in styling. It could be another way to do it. WHEN can be used in multiple ways.


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
May 24, 2017, 10:26 AM
J.L. Hinds
Jason, this will work I think.

TYPE=DATA, COLUMN=SSTORES, BACKCOLOR=RED,COLOR=WHITE, WHEN=SFLAG EQ 'L', $
TYPE=DATA, COLUMN=SSTORES, BACKCOLOR=YELLOW, WHEN=SFLAG EQ 'M', $
TYPE=DATA, COLUMN=SSTORES, BACKCOLOR=GREEN,COLOR=WHITE, WHEN=SFLAG EQ 'H', $
TYPE=DATA, COLUMN=N5,COLOR=BLACK,BACKCOLOR=YELLOW,STYLE=BOLD, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N6,COLOR=YELLOW,BACKCOLOR=YELLOW,STYLE=BOLD, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N7,COLOR=YELLOW,BACKCOLOR=YELLOW,STYLE=BOLD, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N8,COLOR=YELLOW,BACKCOLOR=YELLOW,STYLE=BOLD, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N9,COLOR=YELLOW,BACKCOLOR=YELLOW,STYLE=BOLD, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N10,COLOR=YELLOW,BACKCOLOR=YELLOW,STYLE=BOLD, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N11,COLOR=YELLOW,BACKCOLOR=YELLOW, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N12,COLOR=YELLOW,BACKCOLOR=YELLOW, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N13,COLOR=YELLOW,BACKCOLOR=YELLOW, WHEN=TSORT EQ 'X',$
TYPE=DATA, COLUMN=N14,BACKCOLOR=YELLOW, WHEN=TSORT EQ 'X',$


WebFOCUS 7.6
Windows, All Outputs
May 24, 2017, 11:24 AM
j.gross
quote:
Originally posted by Jason-1:
...

Is there some relatively easy way in webfocus to to just color/style cells in a grid based on all the values displayed -- i.e. higher value cells are darker, lower value cells are lighter, 0's are white?


You can achieve a close approximation of Excel's Conditional Formatting > Color Scales feature for data in a column. Use COMPUTE (with NOPRINT) to capture the minimum and maximum values of the column, then further compute the range, and the endpoints of sections (quartiles or deciles or whatever granularity achieves a satisfactor gradient effect). Define a corresponding set of RGB color declarations (amper variables) for the sections thus defined, and reference them in your WHEN clauses for the background color of the column's cells.


I have an Excel file that will generate the RGB vars, for a 15-color breakdown. Send me a PM if you would like a copy.


- Jack Gross
WF through 8.1.05
May 28, 2017, 11:49 AM
Doug
quote:
TYPE=DATA, COLUMN=N7,COLOR=YELLOW,BACKCOLOR=YELLOW,STYLE=BOLD, WHEN=TSORT EQ 'X',$
basic condtional formatting as seen in the above syntax will work. Although, I prefer using COLUMN=FileName rathe than COLUMN=N#. This makes it easier to mantan and follow the logic. Perhaps a NFR can be added to allow the selection of fields by name as well as reference numbers.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206