Focal Point
Calling Multiple FEXs from an HTML page

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

December 22, 2006, 01:22 PM
mgd
Calling Multiple FEXs from an HTML page
Hi, I'm running WF 5.24 on Windows XP. I have a HTML page that has a drop down list for the user to select a report. Once the report is selected and they hit View, I interrogate the value and based on that value do a GOTO that should, theoretically EX that foc exec.

The problem I'm having is that my -if tests don't seem to be working and the code just keeps falling through my tests. I've tried it with the THEN GOTO, the IF THEN ELSE, I've thrown in a bunch of -RUNs but it keeps wanting to execute only the first section's code.

Any ideas what I'm missing?

My code and code results are below

code..
..


-HTMLFORM END
-EXIT

-RPTCode
-SET &ECHO = ALL;
-TYPE '&SELCRITERIA1';
-IF '&SELCRITERIA1' EQ 'bestex' THEN GOTO BESTEX;
-RUN
-IF '&SELCRITERIA1' EQ 'txnact' THEN GOTO TXNACT;
-RUN
-BESTEX
-RUN
EX RPT_DRVR
-RUN
-GOTO CONTD;
-RUN
-TXNACT
-RUN
EX webmd_ah_txnact
-RUN
-GOTO CONTD;
-RUN
-CONTD
END

Here are my results (I intentionally put in a bad fex name to see the results while testing)

-DEFAULT &SELCRITERIA1 = '';    
-DEFAULT &INITPAGE = 'yes'; 
-IF no EQ 'no' GOTO RPTCode;
-RPTCode
-SET &ECHO = ALL;
-TYPE  'txnact';
'txnact';
-IF 'txnact' EQ 'bestex' THEN GOTO BESTEX;
-RUN
-IF 'txnact' EQ 'txnact' THEN GOTO TXNACT;
-RUN
-BESTEX                        
-RUN                             
EX RPT_DRVR
-RUN                           
(FOC227) THE FOCEXEC PROCEDURE CANNOT BE FOUND: RPT_DRVR
December 22, 2006, 01:45 PM
vaayu
Try it without -RUN after the -IF stmts.


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
December 22, 2006, 02:21 PM
mgrackin
Do you have quotes around the & variables in the -IF statement? Remove the single quotes from around the & variables in the -IF statements.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
December 22, 2006, 02:26 PM
mgrackin
The code does not work because it is comparing the name of the variable to the value. The NAME of the variable will never EQ the value.

There are actually two ways to fix this.

NO QUOTES AROUND THE & VARIABLE:

-SET &DUMMY='MAGTEST';
-IF (&DUMMY EQ 'MAGTEST') GOTO YES;
-TYPE THEY DO NOT MATCH
-GOTO THEEND
-YES
-TYPE THEY MATCH!!!
-THEEND

or

USE .EVAL ON THE & VARIABLE NAME IN THE QUOTES:

-SET &DUMMY='MAGTEST';
-IF ('&DUMMY.EVAL' EQ 'MAGTEST') GOTO YES;
-TYPE THEY DO NOT MATCH
-GOTO THEEND
-YES
-TYPE THEY MATCH!!!
-THEEND


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
December 22, 2006, 02:29 PM
drew billingslea
you might want to try something like:

-RPTCode
-SET &ECHO = ALL;
-TYPE &SELCRITERIA1
-SET &FRUN = DECODE &SELCRITERIA1 ('bestex' 'RPT_DRVR'
- 'txnact' 'webmd_ah_txnact' ELSE '???');
EX &FRUN
-RUN
-CONTD

hth,

drew


WF 7.6.6 Linux, FOCUS 7.8 zOS
December 23, 2006, 04:29 PM
susannah
agree with Mickey and Drew, and here's another flavor
-*
-RPTCode
-GOTO do.&SELCRITERIA1 ;
-do.bestex
-RUN
EXEC RPT_DRVR
-RUN
-GOTO eoj.launch;
-RUN
-do.txnact
-RUN
EXEC webmd_ah_txnact
-RUN
-GOTO eoj.launch;
-RUN
-eoj.launch
END




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 28, 2006, 10:14 AM
mgd
Yes! Thank-you folks for your awesome suggestions and techniques, I'm filing those away for future reference. This makes a huge impact on my website plans. And I'm very glad to know that the single quotes around my variable would impact the query that way. Thanks so much. Happy and Healthy New Year to all