Focal Point
[SOLVED]How to pass multiple values of same parameter name through URL?

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

October 23, 2013, 11:36 AM
Rifaz
[SOLVED]How to pass multiple values of same parameter name through URL?
Hi,

How to pass the multiple values of same parameter name by calling through URL(non-MRE reports)?

For a single parameter value, below URL value works
http://localhost:8080/ibi_apps/WFServlet?IBIF_ex=test&CNTY=ITALY  


-* test.fex
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ '&CNTY';
END


Now, how to pass "Multiselect OR" type?

Let's say, ENGLAND & ITALY on the same URL.

Thanks,
Rifaz

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


-Rifaz

WebFOCUS 7.7.x and 8.x
October 23, 2013, 12:14 PM
njsden
There are many different ways to it. Try this URL for instance although it may look a bit "hack-y" Smiler

/ibi_apps/WFServlet?IBIF_ex=test&CNTY=%27ITALY%27%20OR%20%27ENGLAND%27


There I am attempting to pass 'ITALY' OR 'ENGLAND' as the actual parameter. Note that single quotes are part of the value; therefore, you'd adjust your WHERE condition slightly:

-* test.fex
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ &CNTY ;
END


Hope that helps.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
October 23, 2013, 12:29 PM
Rifaz
Thanks njsden,

It works actually,but how did you know this junkie needs to be included in the URL %27 and %20, do we need to see it in any trace files?

Regards,
Rifaz


-Rifaz

WebFOCUS 7.7.x and 8.x
October 23, 2013, 03:03 PM
Doug
%27 is a single quote, and %20 is a space... Spaces are not allowed in URLs.
October 23, 2013, 03:06 PM
Francis Mariani
Rifaz, are you using HTML Composer to design a parameter screen? If so, a control with the multiple option selected will automatically pass the multiple values with the OR inserted between each selected value. Depending on how you developed the report and the parameter screen, you can also have AND or commas separating the multiple values.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 23, 2013, 05:38 PM
nd
The %20 and %27 are from a tool called URL Encoding.

If you have
 WHERE COUNTRY EQ &CNTY 


And you pass the parameters as in njsden's example above, WebFOCUS would have an ordinary string as the parameter value, without the encoded characters. So that it would resolve to
 WHERE COUNTRY EQ 'ITALY' OR 'ENGLAND' 


Your web server logs (not focus traces) would be the place to capture whether the URLS had encoded characters. They show the % signs and so forth.


WF: WebFocus 7.7.03
Data: Oracle, MSSQL, DB2
OS: Windows
Output: HTML/AHTML,PDF,EXL2K FORMULA, COMT
October 25, 2013, 12:29 AM
Rifaz
Thanks Doug & nd,

Francis, I'm using MS SharePoint, not our HTML Composer.

Thanks,
Rifaz


-Rifaz

WebFOCUS 7.7.x and 8.x
October 25, 2013, 12:43 AM
Rifaz
In 80,i know, we can call the fex in MR by
http://servername:portnumber/ibi_apps/views.bip?BIP_REQUEST_TYPE=BIP_RUN&BIP_folder=IBFS:/WFC/Repository/foldername&BIP_item=procedurename.fex  

Which is the better way to call the fex either from EDASERVE or MR?


-Rifaz

WebFOCUS 7.7.x and 8.x
October 25, 2013, 01:36 AM
Danny-SRL
I would suggest:
/ibi_apps/WFServlet?IBIF_ex=test&CNTY=ITALY%27%20OR%20%27ENGLAND


and:
  
-* test.fex
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ '&CNTY';
END

for syntax purposes.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

October 25, 2013, 04:47 AM
<FreSte>
Passing multiple values with the same name will cause index'd variables in WebFOCUS

If you pass this URL: /ibi_apps/WFServlet?IBIF_ex=test&CNTY=ITALY and you would do

-? &CNTY in your test.fex it will show you:

  CURRENTLY DEFINED & VARIABLES STARTING WITH 'CNTY':
  &CNTY         = ITALY


If you pass this URL: /ibi_apps/WFServlet?IBIF_ex=test&CNTY=ITALY&CNTY=ENGLAND&CNTY=JAPAN

-? &CNTY in your test.fex it will show you:

  CURRENTLY DEFINED & VARIABLES STARTING WITH 'CNTY':
  &CNTY         = ITALY
  &CNTY0        = 3
  &CNTY1        = ITALY
  &CNTY2        = ENGLAND
  &CNTY3        = JAPAN


Variable &CNTY0 will tell you how many &CNTYxx variables there are.
Variable &CNTY will always be the same as the first index'd variable (&CNTY1)

In your fex you can do something like this:

-DEFAULTH &CNTY0 = 0;

TABLE FILE CAR
  SUM 
    DEALER_COST
  BY COUNTRY
  WHERE COUNTRY EQ &CNTY.QUOTEDSTRING
-REPEAT :LB_LOOP_CNTY FOR &I FROM 2 TO &CNTY0;
  OR &CNTY.&I.QUOTEDSTRING
-:LB_LOOP_CNTY
;
END

October 25, 2013, 01:44 PM
Rifaz
Thanks Daniel for your confirmation.
FreSte, your suggestion helps me a lot in this. I'm going to bookmark this. Good One

Thanks,
Rifaz


-Rifaz

WebFOCUS 7.7.x and 8.x