Focal Point
[Code Sharing] Saving amper variables to file
August 29, 2014, 10:30 AM
<FreSte>[Code Sharing] Saving amper variables to file
This could be a very handy technique.
For instance, when you click on a hyperlink (drilldown) with many many parameters which will generate an URL
that will exceed the maximum length for an URL.
Just write (all) ampers to a file in the FOCCACHE directory with an unique name and add this filename
to the parameters in the drilldown definition in your fex.
In the fex that is called by the hyperlink, include this fex and all parameters are set.
-Fred-
-* --- Define some temp-variables
-SET &PA_TEMP1 = 'This';
-SET &PA_TEMP2 = 'That';
-SET &PA_TEMP3 = 'Wendy's';
-SET &PA_COUNTRY = 'ENGLAND';
-SET &PA_QWERTY = 'Netherlands';
-RUN
-? & SAVE FOCCACHE/inc_amp.fex
-RUN
The file inc_amp.fex in the FOCCACHE directory looks like this:
-*CURRENTLY DEFINED VARIABLES:
-DEFAULT &ECHO = 'OFF ';
-SET &EXCELSERVURL = 'SET EXCELSERVURL=http://localhost:80/ibi_apps';
-SET &FOCEXURL = '/ibi_apps/WFServlet?IBIF_webapp=/ibi_apps&IBIC_server=EDASERVE&IBIWF_msgviewer=OFF&';
-SET &FOCHTMLURL = '/ibi_html';
-SET &FOCREL = M727705D;
-SET &GOOGLEMAPSAPIKEY = ' ';
-SET &IBIMR_domain = ' ';
-SET &PA_COUNTRY = 'ENGLAND';
-SET &PA_QWERTY = 'Netherlands';
-SET &PA_TEMP1 = 'This';
-SET &PA_TEMP2 = 'That';
-SET &PA_TEMP3 = 'Wendy''s';
-SET &WFDESCRIBE = XMLRUN;
August 29, 2014, 10:33 AM
Tony AHi Fred,
How on earth did you find that?
Great method and thanks for sharing!
T
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | | |
WebFOCUS App Studio 8.2.06 standalone on Windows 10 | |
August 31, 2014, 05:33 PM
WazLooks like it came in with V7.7 something.
Waz...Prod: | WebFOCUS 7.6.10/8.1.04 | Upgrade: | WebFOCUS 8.2.07 | OS: | Linux |
Outputs: | HTML, PDF, Excel, PPT |
In Focus since 1984 |
Pity the lost knowledge of an old programmer! |
September 02, 2014, 07:35 AM
Wep5622That doesn't seem to work here, not sure why as we're on v7.7.04 as well. We use FOCCACHE all the time, so it's certainly enabled...
Adding:
WHENCE inc_amp FOCEXEC
-RUN
Results in: (FOC1892) FILE NOT FOUND : inc_amp FOCEXEC
Anyway, intriguing feature. I had been wondering whether it would be possible to obtain a list of parameters like this to aid in creating/maintaining drilldown parameter lists by simply modifying a copy of the parameter list of the current procedure.
For example, creating EXL2K output for the current report could then be done by something similar to:
HEADING
"Excel export"
...
TYPE=HEADING, LINE=1,
FOCEXEC=&FOCFEXNAME(
-INCLUDE FOCCACHE/inc_amp.fex
WFFMT='EXL2K'
),
$
Of course, the current list of params isn't formatted correctly for using directly in a STYLE declaration. It would also be convenient to be able to prune parameters from that list that aren't needed in the drilldown (or that are to be replaced with the same parameter(s) with a different value).
Any chance this could work something like this?:
-? & HOLD FOCCACHE/paramList
-RUN
TABLE FILE paramList
PRINT VALUE
BY PARAMETER
END
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
December 23, 2015, 01:55 PM
vaayuThis is a brilliant technique for a quick way to save/retrieve all parms. But, I am looking for a way to save all parms as fields in a .foc or some table to retrieve in future. Almost like buidling Save Selection on Portal. Please advise if theres an easy way. I have a not so elegant way to create define for each parm and PRINT/HOLD and then keep appending by -MORE as we different users run diff selection.
-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
December 24, 2015, 04:31 AM
Tony AA quick search on "capture variables" gives
this post from GamP from 2007.
Susannah and I also gave a presentation on this in Summit 2013 - I no longer have the PPT though
T
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | | |
WebFOCUS App Studio 8.2.06 standalone on Windows 10 | |
December 24, 2015, 12:35 PM
J.L. Hindsvaayu, is this along the lines of what you're trying to do???
-SET &JEFF1='HI';
-SET &JEFF2='THERE';
-SET &JEFF3='STRANGER';
DEFINE FILE CAR
VAR1/A10='&JEFF1.EVAL';
VAR2/A10='&JEFF2.EVAL';
VAR3/A10='&JEFF3.EVAL';
END
TABLE FILE CAR
WRITE VAR1 VAR2 VAR3
BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS 'VAR_KEEP' FORMAT FOCUS
END
TABLE FILE VAR_KEEP
PRINT
VAR1 VAR2 VAR3
ON TABLE HOLD AS HOLDIT FORMAT BINARY
END
-RUN
-DEFAULTH &VAR1=0
-DEFAULTH &VAR2=0
-DEFAULTH &VAR3=0
-READFILE HOLDIT
-RUN
-SET &JEFF1=&VAR1;
-SET &JEFF2=&VAR2;
-SET &JEFF3=&VAR3;
-TYPE &JEFF1
-TYPE &JEFF2
-TYPE &JEFF3
WebFOCUS 7.6
Windows, All Outputs
December 25, 2015, 12:04 PM
vaayuYes, more likely, I'll have it HOLD as focus table the first time then keep appending each time when they run the report request as an INCLUDE.
Thanks for the feedback guys !
quote:
-SET &JEFF1='HI';
-SET &JEFF2='THERE';
-SET &JEFF3='STRANGER';
DEFINE FILE CAR
VAR1/A10='&JEFF1.EVAL';
VAR2/A10='&JEFF2.EVAL';
VAR3/A10='&JEFF3.EVAL';
END
TABLE FILE CAR
WRITE VAR1 VAR2 VAR3
BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS 'VAR_KEEP' FORMAT FOCUS
END
-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************