Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] WebFocus 8 - Colorize cell
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] WebFocus 8 - Colorize cell
 Login/Join
 
Member
posted
Hi all,

I display table in which I want colorize cell depends on value which is in it.
I try search but do not found anything.
Does anyone try do something like that?

Maybe this information is important I use 2 levels of across to build this table.

Regards,
Mateusz

This message has been edited. Last edited by: FP Mod Chuck,
 
Posts: 6 | Registered: March 25, 2019Reply With QuoteReport This Post
Virtuoso
posted Hide Post
1. What version of WebFOCUS are you using? (Very useful info that you should probably put into your Focal Point Signature.)
2. Which authoring tool are you using? (InfoAssist or App Studio)
3. Search the doc for Traffic Light or Conditional Styling. https://infocenter.information...ource%2Ftopic168.htm

4. It's always helpful to provide an example of what you've tried using a WebFOCUS Sample file so we can give you more specific answers.


WebFOCUS 8206, Unix, Windows
 
Posts: 1791 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Member
posted Hide Post
1. I use WebFocus 8.1
2. I developing via App Studio.
3. Thank you for this url. I will look at it.
4. I want receive the following result
 TABLE FILE CAR
SUM
SALES
BY COUNTRY
ACROSS SEATS

ON TABLE SET STYLESHEET *
TYPE=REPORT, ACROSSCOLUMN=SALES, BACKCOLOR=SILVER, WHEN= SEATS EQ 4,$
END  


But using styling from this file:
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,

Also I want color cells contain via row, but manual for formating which I found works via column.

Is it possible?
 
Posts: 6 | Registered: March 25, 2019Reply With QuoteReport This Post
Silver Member
posted Hide Post
Hello Mateusz,

Sometimes workarounds are the solution, if you can't immediately determine how to code something directly.

Seeing your question, this coding example comes to mind as a possible solution.

-* pull all the records for the report to a hold file
TABLE FILE CAR
SUM SALES BY COUNTRY BY SEATS
ON TABLE HOLD
END
-* make a hold file to flag for the countries that have 4 seats.
TABLE FILE HOLD
PRINT COUNTRY AS 'FLAGGED'
BY COUNTRY
WHERE SEATS EQ 4
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS HOLD1
END
-* produce the report
JOIN COUNTRY IN HOLD TO COUNTRY IN HOLD1
END
TABLE FILE HOLD
SUM SALES FLAGGED NOPRINT BY COUNTRY
ACROSS SEATS
ON TABLE SET STYLESHEET *
TYPE=REPORT, ACROSSCOLUMN=SALES, BACKCOLOR=SILVER, WHEN=FLAGGED NE ' ',$
END

is this a possible solution until you can determine how to code it directly?


WebFocus 7x, 8x, Win / Linux, any output format
 
Posts: 47 | Location: reading, pa | Registered: April 07, 2007Reply With QuoteReport This Post
Master
posted Hide Post
quote:
Sometimes workarounds are the solution

Truer words...I've been thinking about writing a book called 1001 IBI workarounds


Hallway
WF(Prod):8202M1
WF(Test):8202M4
OS/Platform:Win 10
Outputs:All
 
Posts: 547 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Master
posted Hide Post
quote:
Originally posted by Mateusz:
1. I use WebFocus 8.1
2. I developing via App Studio.
3. Thank you for this url. I will look at it.
4. I want receive the following result
 TABLE FILE CAR
SUM
SALES
BY COUNTRY
ACROSS SEATS

ON TABLE SET STYLESHEET *
TYPE=REPORT, ACROSSCOLUMN=SALES, BACKCOLOR=SILVER, WHEN= SEATS EQ 4,$
END  


But using styling from this file:
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,

Also I want color cells contain via row, but manual for formating which I found works via column.

Is it possible?


Is this what you are looking for?
  
TABLE FILE CAR
SUM 
    CAR.BODY.SALES
BY  CAR.ORIGIN.COUNTRY
ACROSS CAR.BODY.SEATS
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/endeflt.sty,
$
     DEFMACRO=COND0001,
     MACTYPE=RULE,
     WHEN=A1 EQ 4,
$
TYPE=DATA,
     ACROSSCOLUMN=N1,
     BACKCOLOR='SILVER',
     MACRO=COND0001,
$
ENDSTYLE
END


Hallway
WF(Prod):8202M1
WF(Test):8202M4
OS/Platform:Win 10
Outputs:All
 
Posts: 547 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Member
posted Hide Post
Hi all,

Thank you very much for answers and your help.
Unfortunately, my business case is unusual.

Yes - I can confirm - workaround is the solution ; - )

The javascrpt call resolve my issue,
because values are defined via rows - not columns.

This is code which do the job:
 
-HTMLFORM BEGIN
<HTML>
	<script type="text/javascript">
		var body = document.getElementsByTagName('body')[0];
		var table = document.getElementsByTagName('table')[0];

		// colors
		var green = 'rgba(0, 176, 80, 1)';
		var light_green = 'rgb(228,242,239)';
		var yellow = 'rgba(255, 255, 0, 1)';
		var orange = 'rgb(249,178,88)';
		var dark_orange = 'rgba(255, 192, 0, 1)';
		var red = 'rgb(252,0,25)';

		function f1(row) {
			for (var i=1; i<row.length-1; i++) {
				if (parseInt(row[i].innerText) >= 0 && parseInt(row[i].innerText) <= 14) {
					row[i].style.backgroundColor = green; // green
				} else {
					row[i].style.backgroundColor = red; // red
				}
			}
		}

		function f2(row) {
			for (var i=1; i<row.length-1; i++) {
				if (parseInt(row[i].innerText) >= 0 && parseInt(row[i].innerText) <= 4) {
					row[i].style.backgroundColor = green; // green
				} else if (parseInt(row[i].innerText) >= 5 && parseInt(row[i].innerText) <= 9) {
					row[i].style.backgroundColor = yellow; // yellow
				} else {
					row[i].style.backgroundColor = red; // red
				}
			}
		}

		if (table) {
			var rows = table.children[0].children;

			for (var i=4; i<rows.length-2; i++) {

				switch(i) {
				
					case 4:
						// f1
						f1(rows[i].cells);
					break;

					case 5:
						// f2
						f2(rows[i].cells);
					break;

					default:
						console.log('default');

				}
			}
		}
	</script>


</HTML>

-HTMLFORM END

-RUN 
 
Posts: 6 | Registered: March 25, 2019Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] WebFocus 8 - Colorize cell

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.