Focal Point
[SOLVED] How do you call a procedure using a variable?

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

February 10, 2017, 03:48 PM
Computernerd1957
[SOLVED] How do you call a procedure using a variable?
I'm new to WebFOCUS 8. In 7.76 it was easy to dynamically execute FOCEXECS. I can't seem to do it in WF8.

Here is my Code:

-DEFAULT &FEXNAME='pdash_list_events.fex'
-SET &FEXNAMEX=IF &FEXNAME EQ 'FOC_NONE' THEN 'pdash_list_events.fex' ELSE &FEXNAME;
-SET &FEXNAME=&FEXNAMEX;
-SET &EX_NAME = 'EX IBFS:/WFC/Repository/PD2_HANA_RNA4/&FEXNAME.EVAL PDASH_HOT_ALERT=''&PDASH_HOT_ALERT'', PDASH_ASSIGNED=''&PDASH_ASSIGNED'', PDASH_GROUPING=''&PDASH_GROUPING'', PDASH_MANAGER=''&PDASH_MANAGER'', PDASH_USER=''&PDASH_USER'', PDASH_REDONLY=''&PDASH_REDONLY'', PDASH_DATE=''&PDASH_DATE'', PDASH_FMT=''&PDASH_FMT'' ' ;
&EX_NAME.EVAL
END

When I run ti I get:
-SET &EX_NAME = 'EX IBFS:/WFC/Repository/PD2_HANA_RNA4/pdash_list_events.fex PDASH_HOT_ALERT=''REG'', PDASH_ASSIGNED=''ALL'', PDASH_GROUPING=''ALL'', PDASH_MANAGER=''ALL'', PDASH_USER=''UNKNOWN'', PDASH_REDONLY='' '', PDASH_DATE=''ALL'', PDASH_FMT=''HTML'' ' ;
EX IBFS:/WFC/Repository/PD2_HANA_RNA4/pdash_list_events.fex PDASH_HOT_ALERT='REG', PDASH_ASSIGNED='ALL', PDASH_GROUPING='ALL', PDASH_MANAGER='ALL', PDASH_USER='UNKNOWN', PDASH_REDONLY=' ', PDASH_DATE='ALL', PDASH_FMT='HTML'
END
(FOC227) THE FOCEXEC PROCEDURE CANNOT BE FOUND: pdash_list_events.fex


How can I use a variable to execute a procedure?

This message has been edited. Last edited by: Tamra,


WebFOCUS 7.7.4
Windows
HTML, EXCEL, PDF Outputs
February 12, 2017, 03:45 PM
Waz
No, you cant have parameterised fex names in WF8, unless you have your code in the app directories.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

February 13, 2017, 12:52 AM
Avinash
quote:
HOT



Hi Computernerd1957,

You can try as per below code-
If your report have such parameter, It will automatically pass to the report.

-DEFAULT &FEXNAME='pdash_list_events.fex'
-SET &FEXNAMEX=IF &FEXNAME EQ 'FOC_NONE' THEN 'pdash_list_events.fex' ELSE &FEXNAME;
-SET &FEXNAME=&FEXNAMEX;

-TYPE &PDASH_HOT_ALERT;
-TYPE &PDASH_ASSIGNED
-TYPE &PDASH_GROUPING
-TYPE &PDASH_MANAGER
-TYPE &PDASH_USER
-TYPE &PDASH_REDONLY
-TYPE &PDASH_DATE
-TYPE &PDASH_FMT

-INCLUDE IBFS:/WFC/Repository/PD2_HANA_RNA4/&FEXNAME.EVAL


Thanks!
@vi

WebFOCUS 8105, Dev Studio 8105, Windows 7, ALL Outputs
February 13, 2017, 10:31 AM
Francis Mariani
Regretfully, Avinash, your example does not work.

In the following simplified code, line two does not work, while line three does.

-SET &FEXNAME = 'fm_dummy100.fex';
-INCLUDE IBFS:/WFC/Repository/_fm_test_folder_main/folder200/&FEXNAME.EVAL
-*-INCLUDE IBFS:/WFC/Repository/_fm_test_folder_main/folder200/fm_dummy100.fex


I don't think this behaviour changed for WF 8.1.05, but if it did, Hallelujah!


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
February 13, 2017, 10:55 AM
Computernerd1957
Using a variable on -INCLUDE does not work at all, it fails trying to get started saying symbols are not allowed.

I need a way to dynamically call a procedure based on a value in a variable.

This was so easy in WF7.


WebFOCUS 7.7.4
Windows
HTML, EXCEL, PDF Outputs
February 13, 2017, 11:33 AM
Tom Flynn
Francis,
Please try your example again with -MRNOEDIT:
 
-SET &FEXNAME = 'fm_dummy100.fex';
-MRNOEDIT -INCLUDE IBFS:/WFC/Repository/_fm_test_folder_main/folder200/&FEXNAME.EVAL
 



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
February 13, 2017, 11:45 AM
Computernerd1957
If I use the -MRNOEDIT the Include has the correct FEX name but it doesn't execute and gives no errors.

If I use -MRNOEDIT with an "EX" Command it says (FOC227) THE FOCEXEC PROCEDURE CANNOT BE FOUND: pdash_list_events.fex

The Path is fully qualified and the procedure does exist.


WebFOCUS 7.7.4
Windows
HTML, EXCEL, PDF Outputs
February 13, 2017, 12:03 PM
eric.woerle
From my understanding, even in 7.x, you never could parameterize the execution of a Fex in the procedure using EX / INCLUDE. From what I understand about how this works is that the EX / INCLUDE gets evaluated before any variables get evaluated. Because of this, .EVAL doesn't work and MRNOEDIT won't work either. What I've always done is to use GOTO's to jump to the fex I need to execute instead of using a variable for the Fex name in the procedure.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
February 13, 2017, 12:12 PM
Francis Mariani
-GOTO is the only way. I tried -WRITE to create a fex with one line to -INCLUDE the appropriate fex - that doesn't work either.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
February 13, 2017, 02:05 PM
eric.woerle
ya, EX / INCLUDE are one of the first things to get processed. And from my understanding, there is no way to push the processing of a variable above the processing of the EX / INCLUDE in the order of operations.

As they taught us in grade school... its a "Please Excuse My Dear Aunt Sally" issue (Parentheses/Exponents Multiply/Divide Add/Subtract)


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
February 13, 2017, 03:34 PM
Waz
what you have to understand is that the WebFOCUS client (items stored in the repository) has a parser to work out what files to send to the reporting server.

If the file has an amper variable in or part of the name, it will not get evalualated, because the code is only at the client , and not reached the WebFOCUS server.

This is why, when you trace (ECHO=ALL) the output of a run, you will find that the original code will change.

-INCLUDE IBFS:/WFC/Repository/_fm_test_folder_main/folder200/fm_dummy100.fex

to

-INCLUDE fm_dummy100.fex


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

February 14, 2017, 05:26 PM
Tamra
The above is true using the Content folder - repository ( WebFOCUS Client). &variables are parsed on the Reporting Server after WebFOCUS Client process identifies the files, fexes, sty, css etc.

Francis's GOTO label is a good easy solution

Just FYI ...
In the Application Folder (EDASERVE) on reporting server the following seems to work: ( as Waz indicated)

-SET &ECHO=ALL;
-SET &RUNFEX = 'CAR_report_1';
-SET &INCLUDE = '-INCLUDE'; <--- or EX
&INCLUDE.EVAL &RUNFEX.EVAL
-EXIT

As Eric says - its all about the order of operations


Thank you for participating in the Focal Point Forum!
Tamra Colangelo
Focal Point Moderator
Information Builders


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
February 15, 2017, 11:58 AM
eric.woerle
That's an interesting trick Tamra. I'll have to try using that to call a fex in the content area and see what happens. Thanks for that!


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
February 15, 2017, 01:13 PM
Computernerd1957
I changed one of my procedures to use the goto method, but I have another dynamic procedure that will not work for.

Thanks everyone for the information.


WebFOCUS 7.7.4
Windows
HTML, EXCEL, PDF Outputs
February 15, 2017, 03:48 PM
Waz
quote:
SET &RUNFEX = 'CAR_report_1';
-SET &INCLUDE = '-INCLUDE'; <--- or EX
&INCLUDE.EVAL &RUNFEX.EVAL


You only need the INCLUIDE or EX set as an amper variable.

The rest does not need to be set as a variable.

In fact, what I like to do is similar.

-SET &Include = 'INCLUDE' ;
.
.
.
-&INCLUDE.EVAL myfex


But keep in mind that this is for fexes that are stored on the reporting server, not in the repository.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!