Focal Point
[SOLVED] Call the same procedure passing different hidden values

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

August 15, 2014, 11:45 AM
masdeval
[SOLVED] Call the same procedure passing different hidden values
Hi all!

I need to do create a HTML with two graph element where each graph call the same procedure X (reference existing procedure). The procedure X receive one parameter. I could create a hidden value to pass to X using the composer. But, what I couldn't do, was create two different hidden values to pass to the two distinct graph element. As the procedure has one parameter, the same hidden value is passed to all procedure calls, even though each chart needs its own value.

Is there a way to differentiate hidden variables to each procedure call in the same HTML page?

Best regards,

Christian

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.6
Windows, All Outputs
August 15, 2014, 12:20 PM
eric.woerle
masdeval,

yes you can do this. The simplest and easiest way to do this is to make sure that your variable in each report is unique between them. say &var1 and &var2. When using the HTML composer it should prompt you whether you want to create an input for each one. Just select both of them to hidden and you should be good to go. Also, you can add new input elements to the html and using the parameter tab in the html composer, you can associate those hidden inputs to variables in your report. If you are new to this process, I would recommend using the tool for as much of this as possible as there is a lot of xml that gets generated and if you don't understand what is going on with the xml, it is very easy to break things.

Good luck


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
August 15, 2014, 02:16 PM
masdeval
Hi Eric. I think the situation you described is not the same as mine.

There is only one HTML page with two Graph element. Each graph reference an existing external procedure. The external procecure receive the parameter X. I can create a hidden variable to set the parameter. When i do that, the two procedure call booth receive the same value. I couldn't create two hidden variables to set two different values to the two different procedure call.


WebFOCUS 7.6
Windows, All Outputs
August 15, 2014, 03:47 PM
eric.woerle
Sure you can create two different variables, and then handle it on the WebFOCUS side. in that scenario you would send one for one request and the other for the other request. but short of doing that, you would have to create a javascript function that updates the hidden input, executes the first graph, changes the variable and then executes the second graph.

Another thing you could do, if you look at the FORM call, you will see the OnExecute(this) command in the OnSubmit. You could call a function in the OnSubmit of the FORM that updates the input before it fires off the execute function. That would be another way do it.

here is an example of an anchor tag where I do that. The FORM element should have something similar in the onSubmit you can change.
 <a id=excel href="javascript:toggleExcel();OnExecute(form1);toggleExcel();" class="sp-help_link"  requests_list="5">  



Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
August 15, 2014, 04:36 PM
masdeval
The composer creates just one OnSubmit function (as it creates just one form with one hidden variable even I having inserted two graph element). So, there is only one execution of the OnSubmit and how can I make distinction of values passing to the first procedure call and the second?

The composer only creates two forms with two buttons when I choose the option "do not create controls" in the "reference existing external procedure" dialog box. But in that case the hidden variables are not cretaed.


WebFOCUS 7.6
Windows, All Outputs
August 18, 2014, 02:11 AM
Dave
Masdeval,

I think I understand your question. I've wanted to do the same.

for example:
You have -one- graph.fex
And within the same HTML you want to call it twice.
Once with &GRAPHTYPE = 'WEEKBAR' to go in frame1
and
Once with &GRAPHTYPE = 'YEARLINE' to go in frame2.

...and you don't want to make graph1 and a graph2 because they're are almost the same.

My solution:

GRAPH_WEEKBAR.fex:
-SET &GRAPHTYPE = 'WEEKBAR';
-INCLUDE app/GRAPH.fex



GRAPH_YEARLINE.fex:
-SET &GRAPHTYPE = 'YEARLINE';
-INCLUDE app/GRAPH.fex


And use GRAPH_WEEKBAR.fex for frame1
and use GRAPH_YEARLINE.fex for frame2

In this way you call pass all other parameters. Use a different value for one specific parameter.
AND have the real graph code in only one place.

g'luck


_____________________
WF: 8.0.0.9 > going 8.2.0.5
August 18, 2014, 08:32 AM
masdeval
Thank's Dave.

This way will work. The problem is that I will have several HTMLs each calling the procedure several times. What I precisely whant to avoid is have to write to many procedures to treat this issue. Something like two forms with two hidden variables submiting twice to the same procedure. But seems that I won't have other option.


WebFOCUS 7.6
Windows, All Outputs