Focal Point
[SOLVED] Setting up Global Functions

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

September 17, 2009, 03:48 PM
C. Adams
[SOLVED] Setting up Global Functions
Is it possible to set up functions to do the following:

I would like to be able to insert the following code below into every WebFOCUS report we create so that when the footer for our reports needs to change, we only have to change it in one place.

-SET &CUR_DATE = &DATEMDYY;
-SET &CUR_TIME = EDIT(HHMMSS('A8'),'99:$99:$99');
-SET &HOUR=EDIT(&CUR_TIME, '99$$$$$$');
-SET &HOUR2=EDIT(&HOUR);
-SET &HOUR3=IF &HOUR2 GT 12 THEN &HOUR - 12 ELSE &HOUR;
-SET &HOUR4=IF &HOUR2 GT 12 AND &HOUR2 LT 22 THEN '0' || &HOUR3 ELSE &HOUR3;
-SET &HOUR5=IF &HOUR3 GT 9 THEN EDIT(&HOUR4, '99') ELSE EDIT(&HOUR4, '$9');
-SET &AM_PM = IF &HOUR2 GE 12 THEN 'PM' ELSE 'AM';
-SET &CUR_TIME2=&HOUR5 || EDIT(&CUR_TIME,'$$999$$$') || ' ' | &AM_PM || ' CDT';
-SET &CUR_DTTM = &CUR_DATE | ' ' | &CUR_TIME2;

We use the following code to create a footer for our reports (the &CUR_DTTM is used towards the bottom of the code below):

SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF
UNITS=IN, $
SECTION=section1, LAYOUT=ON, METADATA='0.5^0.5^0.5^0.5', MERGE=OFF, ORIENTATION=LANDSCAPE, PAGESIZE=Letter, $
PAGELAYOUT=1, NAME='Page layout 1', text='Page layout 1', TOC-LEVEL=1, BOTTOMMARGIN=.75, TOPMARGIN=.25,METADATA='BOTTOMMARGIN=.75,TOPMARGIN=.1,LEFTMARGIN=0,RIGHTMARGIN=0,', $
COMPONENT='report1', TEXT='report1', TOC-LEVEL=2, POSITION=(1.25 0.15), DIMENSION=(* *), REQUIRED-SPACE=(* 3), METADATA='Z-INDEX: 100; LEFT: 0.15in; OVERFLOW: auto; WIDTH: 10.85in; POSITION: absolute; TOP: 0.063in; HEIGHT: 1.458in; REQUIRED-SPACE-HEIGHT: 3', $
OBJECT=STRING, NAME='text99', TEXT='As of Date: &DATA_STATUS', POSITION=(.5 7.88), MARKUP=OFF, WRAP=ON, DIMENSION=(3.437 0.146), font='ARIAL', color=navy, size=8, METADATA='FONT-SIZE: 8pt; Z-INDEX: 101; LEFT: 0.52in; WIDTH: 3.437in; COLOR: #000099; FONT-FAMILY: Arial; POSITION: absolute; TOP: 8.094in; HEIGHT: 0.146in', $
OBJECT=STRING, NAME='text51', TEXT='For Internal Use Only', POSITION=(5.1 8.0), MARKUP=OFF, WRAP=ON, DIMENSION=(1.354 0.146), font='ARIAL', color=navy, size=8, METADATA='FONT-SIZE: 8pt; Z-INDEX: 103; LEFT: 5.063in; WIDTH: 1.354in; COLOR: #000099; FONT-FAMILY: Arial; POSITION: absolute; TOP: 8.229in; HEIGHT: 0.146in', $
OBJECT=STRING, NAME='text50', TEXT='&Cpyr 2009, Company Name', POSITION=(4.75 7.88), MARKUP=OFF, WRAP=ON, DIMENSION=(2.604 0.146), font='ARIAL', color=navy, size=8, METADATA='FONT-SIZE: 8pt; Z-INDEX: 104; LEFT: 4.396in; WIDTH: 2.604in; COLOR: #000099; FONT-FAMILY: Arial; POSITION: absolute; TOP: 8.083in; HEIGHT: 0.146in', $
OBJECT=STRING, NAME='text1', TEXT='Page of ', POSITION=(9.5 7.88), MARKUP=ON, WRAP=ON, DIMENSION=(1.1 0.167), font='ARIAL', color=RGB(0 0 153), size=8, METADATA='FONT-SIZE: 8pt; Z-INDEX: 105; LEFT: 9.477in; WIDTH: 1.1in; COLOR: #000099; FONT-FAMILY: Arial; POSITION: absolute; TOP: 8.083in; HEIGHT: 0.167in', $
OBJECT=STRING, NAME='text2', TEXT='Run Date: &CUR_DTTM', POSITION=(.5 8.0), MARKUP=OFF, WRAP=ON, DIMENSION=(3.438 0.156), font='ARIAL', color=navy, size=8, METADATA='FONT-SIZE: 8pt; Z-INDEX: 100; LEFT: 0.52in; WIDTH: 3.438in; COLOR: #000099; FONT-FAMILY: Arial; POSITION: absolute; TOP: 8.24in; HEIGHT: 0.156in', $
END
SET COMPONENT='report1'
-INCLUDE pir_rpt
COMPOUND END

Or is there a better way to do this? We need to be able to change the format of Run Date in one place and have it change on all of our reports. The same goes for the Copyright year. I'm open to suggestions! This code will usually run through ReportCaster once the report is created.

Thanks.

This message has been edited. Last edited by: Kerry,
September 17, 2009, 06:23 PM
j.gross
If you put the series of -SET commands to generate standard footing values in a fex file (either on server or within MR), and -INCLUDE that at the top of each report fex, the &vars will be available for reference in the footing.

Is that all you need?


- Jack Gross
WF through 8.1.05
September 18, 2009, 12:57 AM
Anmol
It would be better to make a separate file rather than function..and you can include this file wherever you want.....
that's definitely an easy option....for the maintenance purpose........

regards,
anmol


WebFocus7.6.2, WebFocus 7.1.1,Windows
HTML, PDF and Excel
September 18, 2009, 01:46 AM
SureshKumar
You can have all the SET veraibles with default values and the entire logic in a separate INCLUDE file. Then you can just Assgin values to Variables when needed and call the INCLUDE file wherever necessary.


Webfocus 8002M, 8009
OS: Windows7
September 18, 2009, 09:18 AM
C. Adams
Thanks to all of you for your help. Sometimes it is hard to see the forest for the trees!