Focal Point
how to grab all passed params and values in DM

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

August 13, 2007, 02:16 PM
jodye
how to grab all passed params and values in DM
Hi There

I need to wite a generic fex that will be included at the start of any report and grab the passed parameters. The report could be called by caster or by a post (not get) from a launchpage.

I know I can issue
-SET &ECHO=ALL;
-? &

to see the params... but I want to actually do something with the list, not just display it. Is there a way to cycle through the list of params in DM? Of course the params differ from report to report and the generic fex I need could not contain a list of expected params or anything like that. It must handle whatever is present.

I did see this posting.. from a few years ago

https://forums.informationbuilders.com/eve/forums/a/tpc/...681008331#4681008331

and that is exactly what I am trying to do also. I can do what the original poster did and create a huge param that contains all of the passed params but that would be a major hassle. I will look into that tomcat approach also.

Is there a way to do this now that did not exist in older versions of webfocus?


Thanks

Jodye

This message has been edited. Last edited by: jodye,


WF 8.0.0.5M
August 13, 2007, 11:03 PM
NathanC
Did you see this post?

https://forums.informationbuilders.com/eve/forums/a/tpc/...1057331/m/6791097331
August 14, 2007, 01:42 PM
jodye
Hi Nathan

Yes, that is the post that I mentioned.

Thanks.


WF 8.0.0.5M
August 17, 2007, 01:33 PM
jbmuir
Here's an idea sent to me a while ago by Grzegorz. It builds a parameter list on the client side. You'll have to include code like this on every launch page, but you may find this preferable to the server side approach.
-James
< !-- A launch page: -->
<html> 
<head> 
<title>Launch Form</title> 
<script type="text/javascript"> 
function doSubmit(frm) 
{   
    if (!frm.PARAMNAMES) return true;

    var names = frm.PARAMNAMES;
    var optcnt = 0;
    for (var i=0; i < frm.elements.length; i++)
    {
         var element = frm.elements[i];
         if (element.name == "PARAMNAMES" || element.name == "IBIAPP_app" || element.name == "IBIF_ex"    || element.type == "submit") continue;
         var option = new Option(element.name);
         option.selected = true;
         names.options[optcnt] = option;
         optcnt++;
    }
}
</script> 
</head> 
<body> 
<form name="launchWF" action="/ibi_apps/WFServlet" method="post" onsubmit="doSubmit[this)"> 
<input type="hidden" name="IBIAPP_app" value="tests"/> 
<input type="hidden" name="IBIF_ex" value="catchparams"/> 
<input type="text" name="INPARAM" value="a value"/> 
<select name="MULTISEL" multiple size=2> 
<option value="MOPT1" selected>opt1</option> 
<option value="MOPT2" selected>opt2</option> 
<option value="MOPT3" selected>opt3</option> 
</select> 
<select name="SEL"> 
<option value="SOPT1">opt1</option> 
<option value="SOPT2">opt2</option> 
<option value="SOPT3">opt3</option> 
</select> 
<input type="submit" value="Run Report"/> 
<div style="display:none;"> 
<select name="PARAMNAMES" multiple> 
</select> 
</div> 
</form> 
</body> 
</html>

-* CATCHPARAMS: focexec, dealing with parameters. 
-* -IF &PARAMNAMES.EXISTS  EQ 0 THEN GOTO :NOPARAMS; 
-IF &PARAMNAMES0.EXISTS NE 0 THEN GOTO :STARTLOOP; -SET &PARAMNAMES0 = 1; 
-SET &PARAMNAMES1 = &PARAMNAMES; 
-:STARTLOOP -REPEAT :OUTERLOOP FOR &CNT FROM 1 TO &PARAMNAMES0; 
-TYPE -------------------------------------------- 
-SET &PARAMNAME = &PARAMNAMES.&CNT; 
-SET &LINE = '-TYPE ' | &PARAMNAME | ' = &' || &PARAMNAME ; 
&LINE.EVAL -SET &LINE = '-IF &' || &PARAMNAME || '0.EXISTS EQ 0 THEN GOTO :ENDPAR;';
&LINE.EVAL 
-SET &LINE = '-TYPE Number of multiple items: &' || &PARAMNAME || '0'; 
&LINE.EVAL 
-* Handling multiple parameter value 
-SET &MCNT = 0; 
-SET &LINE = '-SET &' || 'MSTOP = &' || &PARAMNAME || '0;'; 
&LINE.EVAL 
-:LOOPMULTI -SET &MCNT = &MCNT + 1; 
-IF &MCNT GT &MSTOP THEN GOTO :ENDMULTI; 
-SET &LINE = '-TYPE ' | &PARAMNAME | ' = &' || &PARAMNAME || &MCNT; 
&LINE.EVAL 
-GOTO :LOOPMULTI 
-:ENDMULTI 
-*----------------------------------- 
-:ENDPAR 
-:OUTERLOOP 
-: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

This message has been edited. Last edited by: jbmuir,


WF 7.1.6 moving to WF 7.7, Solaris 10, HTML,PDF,XL