[SOLVED] How to pass amper variable to HTMLFORM and then to fex
This question has been asked before, but the response did not include a sample of code...so...
In WebFOCUS MRE 7.7.02 we have a fex in domain1 that does an -HTMLFORM to an htm file which is located in domain2. The HTMLFORM executes multiple fexes to populate drop down boxes and then when the user clicks on the Submit button a final fex is executed. These three fexes are located in domain2 as well.
The fexes in domain2 are using SQL pass thru and therefore are setting the DEFAULT_CONNECTION to a valid data adapter connection name.
We now want to set up a domain3 to process the same HTMLFORM and the same fexes found in domain2; however we want to use a different value for the DEFAULT_CONNECTION. I think we can set up amper variables in the first fex which calls the -HTMLFORM, and then set up an !IBI.AMP.VARNAME in the htmlform to pass to the three fexes.
I think we would include a -SET &VARNAME = 'ORACLEADT'; in the domain1 fex; We would include !IBI.AMP.VARNAME somewhere in the htm code which is located in domain2; We would change code in the three fexes to ENGINE SQLORA SET DEFAULT_CONNECTION &VARNAME We then would include a -SET &VARNAME = 'ORACLEEUT'; in the domain 3 fex. Notice the value is slightly different for &VARNAME.
Can someone confirm my logic? Also, can someone provide the actual syntax I would use to add the !IBI.AMP.VARNAME in the htm code? Can I just insert it anywhere in the code? Do I need to use any other code around it?This message has been edited. Last edited by: Kerry,
WebFOCUS 7.7.02 Window 2003 /32bit
May 09, 2012, 05:05 PM
David Briars
Sounds like you are on the right track.
quote:
can someone provide the actual syntax I would use to add the !IBI.AMP.VARNAME in the htm code?
To pass an amper variable from a fex, to the next fex, via a -HTMLFORM web page, we use hidden text boxes, in the form the user is submitting.
Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
May 10, 2012, 09:18 AM
DanTheMan
is this what your talking about?
-SET &DANNY = 'YAY'; !IBI.AMP.DANNY;
WebFOCUS 7.6 Windows, All Outputs
May 10, 2012, 10:58 AM
Penny_Lester
Thank you David, that is exactly what I was asking for. I assumed I would have to use an input type of hidden, but we all know the dangers in making assumptions. :-)
WebFOCUS 7.7.02 Window 2003 /32bit
May 10, 2012, 11:19 PM
StuBouyer
Penny,
You may want to look at GLOBAL variables rather than using !IBI.AMP.VARNAME;.
In your situation there is no real advantage in creating a hidden control - except to maybe have it visible in the source HTML.
Rather than -SET &VARNAME = 'ORACLEADT'; try -SET &&VARNAME = 'ORACLEADT'; and then ENGINE SQLORA SET DEFAULT_CONNECTION &&VARNAME
&&VARNAME will be avaialble to all FEXes used by that user while their Java session is open and removes the need for a HTML page just to hold the variables.
WebFOCUS 8.2.03 (8.2.06 in testing)
May 11, 2012, 01:13 PM
Penny_Lester
I had considered using a global amper variable but decided the hidden variable was the better option in this case. Thank you for the suggestion.