Focal Point
[SOLVED] Traffic Lights and FML NEW QUESTION

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

July 26, 2019, 09:29 AM
RobertF
[SOLVED] Traffic Lights and FML NEW QUESTION
Is it possible to have a traffic light using FML. So you have your metrics down the page, perhaps months across and evaluate the row to set a traffic light red or green in the final column. We can probably make the entire cell fill with red/green but we want the traffic light round dot symbol.

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


WebFOCUS 8206.08
Windows, All Outputs
July 26, 2019, 09:40 AM
RobertF
we are on version 8008!


WebFOCUS 8206.08
Windows, All Outputs
July 26, 2019, 11:53 AM
FP Mod Chuck
Robert

The way I have done that is to have red, yellow and green images of a round dot and use a DEFINE based on the thresholds you want to use. That should work fine with FML but I haven't tested it...


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
September 27, 2019, 01:53 PM
RobertF
Back on this...we are on 8008..did I understand you used images...can you elaborate or share some code....do you evaluate a condition and if a met display an image...? How does that work?


WebFOCUS 8206.08
Windows, All Outputs
September 29, 2019, 01:02 PM
Doug
I place my images in a common app folder and refer to it in a DEFINE or COMPUTE.





   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
September 30, 2019, 03:07 PM
RobertF
can you share some code...we are on 8008...


WebFOCUS 8206.08
Windows, All Outputs
October 01, 2019, 12:31 PM
FP Mod Chuck
Here is a DEFINE from a master file for the images.

<code>
DEFINE GreenKey/A200='<img src="/approot/gold_standard/g1.png" align="absmiddle" >';
TITLE='Green Key', DESCRIPTION='Green Key',
PROPERTY=UDA, $
DEFINE MiddleKey/A200=' ';
TITLE='Yellow Key', DESCRIPTION='Yellow Key',
PROPERTY=UDA, $
DEFINE RedKey/A200=' ';
TITLE='Red Key', DESCRIPTION='Red Key',
PROPERTY=UDA, $
</code>

MiddleKey and RedKey have the same img definition as GreenKey except a different image but not sure why it is not displaying properly
And here is the code to use them.

<code>
COMPUTE stoplight1/A200 = IF AVE.AVG_HANDLE_TIME LE 5.00 THEN GreenKey ELSE IF AVE.AVG_HANDLE_TIME GT 7.00 THEN RedKey ELSE MiddleKey;
AS ' '
</code>

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


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
October 03, 2019, 10:08 PM
David Briars
quote:
Is it possible to have a traffic light using FML...and evaluate the row to set a traffic light red or green in the final column.


SET PAGE = OFF
TABLE FILE LEDGER
"General Ledger Report"
SUM AMOUNT AS 'Amount' 
 COMPUTE COLOR/A64 = IF AMOUNT GT 25000 THEN 'greendot' ELSE 
                      IF AMOUNT GT 20000 THEN 'bluedot' ELSE 'reddot'; 
                     NOPRINT
 COMPUTE KPI/A256 = '<span class="dot ' | COLOR || '"></span>';
                    AS ''
FOR ACCOUNT
  10$$     AS 'Cash' OVER
  1100     AS 'Accounts Receivable' OVER
  1200     AS 'Inventory'
ON TABLE SET STYLE *
 INCLUDE=warm.sty, $
 TYPE=HEADING, JUSTIFY=CENTER, SIZE=10, $
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<style>
 .dot {
  height: 10px;
  width: 10px;
  border-radius: 50%;
  display: inline-block;  
 }
 .reddot {
  background-color: red;
 }
 .greendot {
  background-color: green;
 }
 .bluedot {
  background-color: blue;
 }
</style>
-HTMLFORM END  





Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
October 06, 2019, 02:31 PM
Doug
Nice one David, Thinking Outside-The-Box Smiler