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.
I have an input parameter that takes in multiple selections. I am trying to generate a where statement that contains each value selected. Currently I am using an amper variable, but I am stuck with the looping. I can not figure out how to move to the next value selected. Any help?
Steve
Posts: 5 | Location: Philadelphia, PA | Registered: February 01, 2005
-IF &CUSTOMER1 EQ 'All' GOTO CUSTALL ; WHERE (CUSTOMER EQ '&CUSTOMER1' -REPEAT ALLCUST FOR &CTR FROM 2 TO &CUSTOMER0 OR '&CUSTOMER.&CTR' -ALLCUST ); -CUSTALL
hth,
drew
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003
-SET &ECHO=ALL;
DEFAULT &Country = 'ALL';
>-SET &COUNTER=0;
TABLE FILE CAR
PRINT CAR MODEL BODYTYPE SALES
BY COUNTRY
IF &Country.EXISTS THEN GOTO
SEL_ONE ELSE GOTO SEL_END;
SEL_ONE
IF &Country EQ 'ALL' GOTO SEL_END;
WHERE COUNTRY EQ '&Country'
IF &Country0.EXISTS THEN GOTO
SEL_MULT ELSE GOTO SEL_END;
SEL_MULT
REPEAT SEL_MULT_END FOR
&COUNTER FROM 2 TO &Country0;
<br />OR '&Country.&COUNTER'
-SEL_MULT_END
SEL_END
END
This message has been edited. Last edited by: <Mabel>,
If one selection was made, the following amper variable is generated:<br />
&Country
= ENGLAND
Where &Country is the first selection made; &Country0 is the number of selections made;<br />&Country1 to &CountryN are all the selections made. In my example fex, if only one selection was made, then the WHERE statement acts on &Country. If more than one was made, then the first part of the WHERE statement acts on &Country and the rest of the WHERE statement acts on &Country2 to &CountryN.This message has been edited. Last edited by: <Mabel>,
Here's another solution that involves copying the multi-valued parameter into a file and then using the useful FOCUS construct: IF PARM EQ (DDPARM)
The code below relies on a multi-valued parameter called DHPARAMS being set up that contains the names of all the parameters being passed to the WFServlet, so it has a layer of indirection in it that you may not want.
Setting up the DHPARAMS parameter name list cannot be done in the WFServlet, and the folks at IBI have not provided us with this useful functionality. Nice, huh? Life with webfocus would be a little easier if they did pass in a multi-valued list of parameter names, since then you could write generic code to handle parameters.
To work around the limitations of the webfocus product you have to extend tomcat, which is not for the faint of heart. You can create a "tomcat filter". Once done you have a really easy way to select multi-valued parameters, but this is probably more complicated that anything you were looking for. Refer to the following posting for info about the java side of things:
Here's the code that builds the files used to handle selection of multi-valued parameters. Perhaps you can revise it to suit your needs.
-* WCMLTPRM - Create multi-valued parameter lists for legacy reports. -* -* Inputs: &DHPARAMS - Parameter array courtesy of the ParamFilter. -* -* &DHLEGACY - 'Y' => legacy report. -* -* Outputs: -* -* The following items are created by this procedure for a multi- -* valued parameter called MYPARM: -* -* 1) A new amper variable: &MYPARM -* 2) A new file named: myparm.dat -* 3) A FILEDEF named: MYPARM -* -* This procedure takes multi-valued parameters passed to webfocus and -* writes them to a file so that the file can then be used to select -* parameter values using the useful focus construct: -* -* IF MYPARM EQ &MYPARM -* -* A new amper variable with the name of the parameter being passed in -* is created that has the value '(MYPARM)'. This value uses a ddname -* created by this procedures to access the values in the file. -* -*---------------------------------------------------------------------- -* 10/21/2004 James Muir Written for webfocus. -*---------------------------------------------------------------------- -*SET &ECHO='ALL'; SET MSG=OFF -RUN -* -*------------------------------- Setup default values. -DEFAULTS &DHLEGACY = 'N'; -* -*------------------------------- Is this a legacy report? -IF &DHLEGACY NE 'Y' THEN GOTO WCMLTPR.DONE; -* -*--------------------------------Get number of parameters to check. -SET &LIMIT1 = &DHPARAMS0; -* -*--------------------------------Loop through all the parameters. -REPEAT WCMLTPLOOP1 FOR &COUNTER1 FROM 1 TO &LIMIT1 STEP 1 -* -*--------------------------------Get a parameter name from DHPARAMS. -SET &MYPARM = 'DHPARAMS' | &COUNTER1; -SET &MYAMPNAME = '&' || &MYPARM; -SET &MYNAME = &MYAMPNAME.EVAL; -* -*--------------------------------Do we have a multi-valued parameter? -SET &TEST = '&' || &MYNAME || '0'; -* -IF &TEST.EVAL.EXIST EQ 0 THEN GOTO WCMLTPLOOP1; -* -*--------------------------------We have a multi-valued parameter. -*--------------------------------Create a FILEDEF for the file that -*--------------------------------will contain the multiple values for -*--------------------------------this parameter. -SET &NAMELEN = &MYNAME.LENGTH; -SET &FILENAME = LOCASE(&NAMELEN,&MYNAME,'A&NAMELEN.EVAL') || '.dat'; FILEDEF &MYNAME DISK &FILENAME (APP RECFM V -RUN -* -*--------------------------------Get number of values to write. -SET &LIMIT2 = &TEST.EVAL; -* -*--------------------------------Loop through all the values. -REPEAT WCMLTPLOOP2 FOR &COUNTER2 FROM 1 TO &LIMIT2 STEP 1 -* -*--------------------------------Get the value of a parameter. -SET &MYMULTI = &MYNAME | &COUNTER2; -SET &MYAMPVALUE = '&' || &MYMULTI; -SET &MYVALUE = &MYAMPVALUE.EVAL; -* -*--------------------------------Write it to the file. -WRITE &MYNAME &MYVALUE -WCMLTPLOOP2 -* -*--------------------------------Create a new amper variable that -*--------------------------------contains the DDNAME reference that -*--------------------------------the user can use to select records -*--------------------------------based on the values of the multi- -*--------------------------------valued parameter. -SET &MYSET = '-SET &' | &MYNAME | ' = ''(' | &MYNAME | ')'';'; &MYSET.EVAL -* -WCMLTPLOOP1 -GOTO WCMLTPR.DONE -* -*--------------------------- Clean up. -WCMLTPR.DONEThis message has been edited. Last edited by: Kerry,
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003