Jump to content

Tips & Tricks WebFOCUS and Font Awesome


Clayton Peacock

Recommended Posts

-SET &ECHO=ALL;

-* Font Awesome - https://fontawesome.com/download
SET CSSURL ='/approot/common/fontawesome/fontawesome-free-6.5.1-web/css/all.css';

DEFINE FILE CAR
FA_EXAMPLES/A100 = '<a target="_blank" href="https://fontawesome.com/search?o=r&|m=free">Free Font Awesome Examples</a>';

FA_DOWNLOAD/A100 = '<a target="_blank" href="https://fontawesome.com/download">Download</a>';

FA_ICON/A100 = IF COUNTRY EQ 'ENGLAND'   THEN '<i class="fa-solid fa-lg fa-chess-king"></i>'            ELSE 
               IF COUNTRY EQ 'FRANCE'    THEN '<i class="fa-solid fa-lg fa-wine-bottle"></i>'           ELSE 
               IF COUNTRY EQ 'ITALY'     THEN '<i class="fa-solid fa-lg fa-pizza-slice"></i>'           ELSE 
               IF COUNTRY EQ 'JAPAN'     THEN '<i class="fa-solid fa-lg fa-user-ninja"></i>'            ELSE 
               IF COUNTRY EQ 'W GERMANY' THEN '<i style="color:#01C851" class="fa-solid fa-2x fa-car"></i>' ELSE '<i class="fa-solid fa-circle-question"></i>';


-* Sizing
FA_SIZING/A100    = '<a target="_blank" href="https://fontawesome.com/docs/web/style/size">Sizing Icons</a>';
FA_SIZING_XS/A50  = '<i class="fas fa-camera fa-xs"> fa-xs</i>';    
FA_SIZING_SM/A50  = '<i class="fas fa-camera fa-sm"> fa-sm</i>';	
FA_SIZING_LG/A50  = '<i class="fas fa-camera fa-lg"> fa-lg</i>';	
FA_SIZING_2X/A50  = '<i class="fas fa-camera fa-2x"> fa-2x</i>';	
FA_SIZING_3X/A50  = '<i class="fas fa-camera fa-3x"> fa-3x</i>';	
FA_SIZING_5X/A50  = '<i class="fas fa-camera fa-5x"> fa-5x</i>';	
FA_SIZING_7X/A50  = '<i class="fas fa-camera fa-7x"> fa-7x</i>';	
FA_SIZING_10X/A50 = '<i class="fas fa-camera fa-10x"> fa-10x</i>';
END

TABLE FILE CAR
HEADING
"Examples Free: <FA_EXAMPLES"
" "
"Download: <FA_DOWNLOAD"
" "
BY COUNTRY
BY FA_ICON

FOOTING
" "
"Examples: <FA_SIZING"
" "
"<FA_SIZING_XS"
"<FA_SIZING_SM"
"<FA_SIZING_LG"
"<FA_SIZING_2X"
"<FA_SIZING_3X"
"<FA_SIZING_5X"
"<FA_SIZING_7X"
"<FA_SIZING_10X"

ON TABLE HOLD AS HLD1 FORMAT HTMTABLE

ON TABLE SET STYLE *
TYPE=DATA,COLUMN=FA_ICON,CLASS='myClass',$
ENDSTYLE
END
-RUN

-HTMLFORM BEGIN
<!DOCTYPE html>
<html>
<head>
<title>Font Awesome + WebFOCUS!</title>
<style>

	.myClass {
		color: #4385F5;
	}

</style>
</head>
<body>
	<h3>Font Awesome</h3>
	<p>
		!IBI.FIL.HLD1;
	</p>
</body>
</html>
-HTMLFORM END
-EXIT

 

fa_example.png

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Awesome. 
People can try it out without having to download and place the all.css file in an app folder.  Reference the all.css at fontawesome.com.
Here is an example of an indicator for Unit Sales over 300,000.

image.png.71832cf45f17a4a02099c7f0f6cab379.png

Here is the code which. The color coding is done with traditional WebFOCUS styling.

 SET CSSURL ='https://use.fontawesome.com/releases/v6.5.1/css/all.css';
 
 TABLE FILE ggsales
 SUM UNITS/I9C
 COMPUTE ICON/A50 = IF UNITS GT 300000 
                    THEN '<i class="fa-solid fa-thumbs-up"></i>' 
                    ELSE '<i class="fa-regular fa-thumbs-down"></i>'; AS ''
 BY REGION
 BY ST
 BY CITY
 ON TABLE SET PAGE NOLEAD
 ON TABLE SET STYLE *
 INCLUDE=IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,$
 TYPE=DATA, SIZE=12, TOPGAP=0.1, $
 TYPE=DATA, COLUMN=ICON, WHEN=UNITS GT 300000, COLOR=GREEN, $
 TYPE=DATA, COLUMN=ICON, WHEN=UNITS LE 300000, COLOR=RED, $
 END

 

Edited by David Beagan
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...