Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Find out passed parameters

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Find out passed parameters
 Login/Join
 
Member
posted
I have a report that uses parameters passed from a selection page (form submitted by method post to WFServlet) to make another (hidden) form. The report page contains a form and several loops like the example below.
It checks if the passed parameter has multiple values and loops the right amount of times.

...
-SET &XIND = 1;
-IF &YTIME0.EXISTS THEN GOTO TIME_LOOP ELSE GOTO TIME_NO_LOOP;
-TIME_NO_LOOP
-IF &YTIME.EXISTS THEN <INPUT type="hidden" name="YTIME" value="&YTIME">
ELSE GOTO TIME_LOOPX
-GOTO TIME_LOOPX
-TIME_LOOP
-IF &XIND GT &YTIME0 THEN GOTO TIME_LOOPX;
<INPUT type="hidden" name="YTIME" value="&YTIME.&XIND">
-SET &XIND = &XIND + 1;
-GOTO TIME_LOOP
-TIME_LOOPX
...

Problem: I want to make this an independent, included fex, which I can use with many forms and reports. How can I find out how the parameters in each submitted form are named? There are different amount of multiple selection lists (which are named differently) in each selection page.
 
Posts: 4 | Location: Finland | Registered: March 26, 2004Report This Post
Expert
posted Hide Post
what an interesting question. well, here's an inelegant approach:
In your fex, lines 2,4,8, and 9 have the variable &YTIME in them, and that's the var you want to change, right?
so, replace these 4 lines in this fex with &vars themselves.
&LINE1, &LINE2, &LINE3 and &LINE4, like this:
-SET &XIND = 1;
&LINE1
-TIME_NO_LOOP
etcetera.
Now, in this fex create each of these &LINES, having passed not only the values but also the NAME of the key variable from the previous form.
-SET &LINE1 = 'IF &' | &MYNEWVARNAME | '.EXIST THEN...etc.
Get the idea?
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Thank you for your quick and not so inelegant tip Susannah!

So I can make another loop for &LINE1,2,3 and 4 where I populate them with every known parameter.

But if I don�t know the names of the parameters? How can I make a loop to populate &MYNEWVARNAME with passed parameters from the previous form?

Like this:

loop for &MYNEWVARNAME
...loop for &LINE1,2,3 and 4
......loop for the form data (original message)
......end loop
...end loop
end loop


If the form was submitted via method GET then the submitted non-hidden parameters could be parsed with javascript, but the method POST is a bit trickier...

I hope somebody has already won this battle.

Thanks in advance
Mikko Muurinen
 
Posts: 4 | Location: Finland | Registered: March 26, 2004Report This Post
<Grzegorz>
posted
Mikko,

Below is the skeleton of one of the possible solutions (if I correctly understand your question).

< !-- A launch page: --><br /><html><br /><head><br /><title>Launch Form</title><br /><script type="text/javascript"><br />function doSubmit(frm) {<br />  if (!frm.PARAMNAMES) return true;<br />  var names = frm.PARAMNAMES;<br />  var optcnt = 0;<br />  for (var i=0; i < frm.elements.length; i++) {<br />     var element = frm.elements[i];<br />     if (element.name == "PARAMNAMES" || <br />         element.name == "IBIAPP_app" ||<br />         element.name == "IBIF_ex"    ||<br />         element.type == "submit") continue;<br />     var option = new Option(element.name);<br />     option.selected = true;<br />     names.options[optcnt] = option;<br />     optcnt++;<br />  } <br />}<br /></script><br /></head><br /><body><br /><form name="launchWF" action="/ibi_apps/WFServlet" method="post" onsubmit="doSubmit(this)"><br /><input type="hidden" name="IBIAPP_app" value="tests"/><br /><input type="hidden" name="IBIF_ex" value="catchparams"/><br /><input type="text" name="INPARAM" value="a value"/><br /><select name="MULTISEL" multiple size=2><br /><option value="MOPT1" selected>opt1</option><br /><option value="MOPT2" selected>opt2</option><br /><option value="MOPT3" selected>opt3</option><br /></select><br /><select name="SEL"><br /><option value="SOPT1">opt1</option><br /><option value="SOPT2">opt2</option><br /><option value="SOPT3">opt3</option><br /></select><br /><input type="submit" value="Run Report"/><br /><div style="display:none;"><br /><select name="PARAMNAMES" multiple><br /></select><br /></div><br /></form><br /></body><br /></html>
-* CATCHPARAMS: focexec, dealing with parameters.<br />-*<br />-IF &PARAMNAMES.EXISTS  EQ 0 THEN GOTO :NOPARAMS;<br />-IF &PARAMNAMES0.EXISTS NE 0 THEN GOTO :STARTLOOP;<br />-SET &PARAMNAMES0 = 1;<br />-SET &PARAMNAMES1 = &PARAMNAMES;<br />-:STARTLOOP<br />-REPEAT :OUTERLOOP FOR &CNT FROM 1 TO &PARAMNAMES0;<br />-TYPE --------------------------------------------<br />-SET &PARAMNAME = &PARAMNAMES.&CNT;<br />-SET &LINE = '-TYPE ' | &PARAMNAME | ' = &' || &PARAMNAME ;<br />&LINE.EVAL<br />-SET &LINE = '-IF &' || &PARAMNAME || '0.EXISTS EQ 0 THEN GOTO :ENDPAR;';<br />&LINE.EVAL<br />-SET &LINE = '-TYPE Number of multiple items: &' || &PARAMNAME || '0';<br />&LINE.EVAL<br />-* Handling multiple parameter value<br />-SET &MCNT = 0;<br />-SET &LINE = '-SET &' || 'MSTOP = &' || &PARAMNAME || '0;';<br />&LINE.EVAL<br />-:LOOPMULTI<br />-SET &MCNT = &MCNT + 1;<br />-IF &MCNT GT &MSTOP THEN GOTO :ENDMULTI;<br />-SET &LINE = '-TYPE ' | &PARAMNAME | ' = &' || &PARAMNAME || &MCNT;<br />&LINE.EVAL<br />-GOTO :LOOPMULTI<br />-:ENDMULTI<br />-*-----------------------------------<br />-:ENDPAR<br />-:OUTERLOOP<br />-:NOPARAMS
The idea is to add to HTML form one multiple select element, named PARAMNAMES and the doSubmit() function invoked on the onsubmit event. doSubmit function checks all the form elements, filter them and if the element is "recognized" as a parameter, its name is added to the PARAMNAMES list, so it will be passed as the CGI request (regardless if the method is POST or GET).
The FEX can handle the list of the parameter names, and then dynamically construct its own code (which makes the "real" work) using .EVAL.

Hope this helps
Grzegorz
 
Report This Post
Member
posted Hide Post
Thank you very much Grzegorz and susannah!!!

This was just what I needed!

Mikko Muurinen
 
Posts: 4 | Location: Finland | Registered: March 26, 2004Report This Post
Expert
posted Hide Post
I was thinking you would add the parameter name actually to the form input and pass it as a hidden var.
but gregorz' way is the absolute coolest!
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Find out passed parameters

Copyright © 1996-2020 Information Builders