Focal Point
[SOLVED] Passing a parameter to an html composer file

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

November 22, 2012, 10:25 AM
Jay Potter
[SOLVED] Passing a parameter to an html composer file
I have created an html file using composer. I have several fexes using the same parameter. When creating the file I used a default value for it to use when executing when loading. I what to be able to pass the parameter value to from another fex. How do I do this with 7703? I tried to put in a parameter value such as &CUST_NO and it did not like it.

This message has been edited. Last edited by: Jay Potter,


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
November 23, 2012, 09:00 AM
BarryS
Hi Jay

If the parameters (control) share the same name in all the reports then when executing the reports the parameters should be passed. The key is that the parameters should be named the same. There is a webinar that shows this and can be found at: http://www.informationbuilders...inars/developers/587

If you continue to have problems with this open a case and we can assist you.

Thanks Barry


WebFOCUS 8103, Windows, App Studio
November 23, 2012, 02:51 PM
Jay Potter
The problem is not when I manually enter in the value after the screen loads and I press the run button. That works great. It is when I want to pass the value from a calling fex. For example I have a report with a list of customer names and numbers. I click on the customer number and it calls the customer screen and loads the customer number before the screen displays. Then all of the sub fexes execute using the value that was passed to it.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
November 25, 2012, 10:45 AM
Twanette
Hi Jay,
How do you run the "sub fexes"?
If they are called by drill-downs, then you need to pass the variable through on the drill down syntax in the style sheet e.g.
,CUST_NO=&CUST_NO.QUOTEDSTRING ,

If you call the sub fexes from an HTMLFORM, then you need to pass the parameter as a hidden variable in the
<FORM></FORM>  

block.
e.g
<input name="CUST_NO" type=hidden value="!IBI.AMP.CUST_NO;"> 
  



WebFOCUS 8.2.06 mostly Windows Server
November 26, 2012, 07:33 AM
David Glick
Passing the name and value pair on the URL would be used if the value is not located anywhere else on the page.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
November 28, 2012, 12:27 PM
Jay Potter
Thanks The !IBI.AMP.CUST_NO did it. As soon as i saw your response, bells and whistles went off.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
November 29, 2012, 09:16 AM
BarryS
Hi Jay

I missed the point. Somehow you retrieved the value from somewhere in a fex and then you are using !IBI.AMP.CUST_NO and that will work. But if you create a control on the HTM page (can be hidden) and populate the control with a table request that gives you one value you can now pass it to the report.

An example would be to populate the control with the value needed:

TABLE FILE CAR
MAX.SALES
BY SALES
ON TABLE PCHOLD FORMAT XML
END

The results will set the control with the maximum sales and then you can assign that value to any control as follows:
function onInitialUpdate(){

//get the value from the control
val MsxSales = IbComposer_getCurrentSelection("MaxSalesControl");

//setCurrentSelection will set the slider1 with the value of edit2
IbComposer_setCurrentSelection("slider1",MaxSales, false);
}


Best of luck with the HTML Composer its a great tool.

Thanks Barry


WebFOCUS 8103, Windows, App Studio
March 20, 2013, 11:28 AM
J.Hines
I'm struggling with almost exactly the same issue. Thanks for the !IBI.AMP tip; I never knew about that.

Using that, I'm getting the value passed from my fex, because I can see it in the HTML source when I run the HTML file. The value in the code is "!IBI.AMP.Load_Id;" and it's getting the parameter when running. Here's the HTML source (notice the value attribute has been set to the passed parameter value):
 <INPUT style="WIDTH: 147px; HEIGHT: 22px" value=C60000220121112080858 type=hidden persistentuniqueid="compUid_1" name="Load_Id">
 


The hangup now is that even though I've bound the hidden control to the outbound parameter on the Parameters tab, the procedure (a graph actually) is not receiving the parameter and is instead using the default value declared in the procedure! I feel like I'm finally so close to solving the fex-to-HTML-to-fex parameter issue, but I'm stuck here!

EDIT: Solved it! I was just playing around a little more and thought maybe having the hidden input and the parameter named the same thing (Load_Id) could possibly be getting something confused, so I gave the input a name and ID of "Load_ID" (capital D) and low and behold, it now works and is passing the parameter to the fex! Hallelujah!

This message has been edited. Last edited by: J.Hines,



Prod: 8.2.0.4 OS:Windows 10 Output:AHTML, Excel 2007+

The life of a designer is a life of fight against the ugliness.
March 20, 2013, 11:42 AM
Dave
J.Hines

I've had a similar issue, but a different solution.

Just run the HTML. Check the source in the browser. Find the input's ID.

Then instead of actually starting the HTML just start a fex with:

-HTMLFORM app/<the name of the actuall HTML here>.htm


and add this to the code below:
userinput_x is the name you found in the source in the browser.
USERINPUT is the name of the variable you want to enter in the input.

-HTMLFORM BEGIN
<SCRIPT LANGUAGE='JSCRIPT'>
document.getElementById('userinput_x').value = '!IBI.AMP.USERINPUT;';
</SCRIPT>
-HTMLFORM END


And you could even replace !IBI.AMP.USERINPUT; with &USERINPUT because it would be resolved anyway.

Good luck


_____________________
WF: 8.0.0.9 > going 8.2.0.5