Focal Point
[SOLVED] Passing a parameter with multiple OR values

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

September 29, 2010, 09:39 AM
Phil_j2w
[SOLVED] Passing a parameter with multiple OR values
Hello,
I'm trying to set up a method for filtering many differnet reports to a particular set of site ids. The method I'd like to use is to have an include file set up a parameter that contains a set of site ids, separated by OR.
Then I want to include this file in other procedures and use the parameter in a WHERE statement. I can make it work with a single value, but when I try to add in the ORs then I don't get any records back. I think the problem might be whether to use or not use quotation marks at points in the code.

Here is how the parameter is set up in my include file:
-SET &ATSCLIENTS = '11' OR '166' OR '18';

Here is how I'm using it in the WHERE statement in another procedure:
WHERE Site_ID11 EQ &ATSCLIENTS;

Can anyone spot a problem here? Thanks!

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


WebFOCUS 7701
Windows 2008
All Formats

September 29, 2010, 10:03 AM
jseaburn
Check your HTML source code when you run the procedure. We had a similar problem and for some reason, the html code was generating "NONE" instead of "OR". We had to use the STRREP function to fix the problem.

SET &FILTER1 = IF POSIT(&FILTER1,&FILTER1.LENGTH,' NONE ',6,'I2') NE 0 THEN STRREP(&FILTER1.LENGTH, &FILTER1, 6, ' NONE ', 4, ' OR ', &FILTER1.LENGTH, 'A&FILTER1.LENGTH') ELSE &FILTER1;  


Not sure if this is your problem, but what you explained sounded familiar to me.


WebFOCUS 7.7.03
Linux / Universe Db
HTML/PDF/EXCEL/HTML Active
September 29, 2010, 10:06 AM
Francis Mariani
If you require embeded quotes in a DM variable, you need to include extra ones:

-SET &CTRS = '''ENGLAND'' OR ''FRANCE'' OR ''JAPAN''';

TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ &CTRS
END


A better alternative would be to put the values in a file, one per line:

FILEDEF CTRS1 DISK CTRS1.TXT
-RUN

-WRITE CTRS1 ENGLAND
-WRITE CTRS1 FRANCE
-WRITE CTRS1 CANADA
-WRITE CTRS1 JAPAN
-WRITE CTRS1 W GERMANY


TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY IN FILE CTRS1
END



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
September 29, 2010, 10:39 AM
Phil_j2w
Thanks for the suggestion jseaburn. My difficultly was the more straighforward. I was missing the extra quotes suggested by Francis. Thanks for the tip, Francis. I'm still pretty GUI dependent but this will help me a lot in the future as well.


WebFOCUS 7701
Windows 2008
All Formats

September 29, 2010, 10:42 AM
Francis Mariani
You can definitely generate code using the GUI that refers to a file for selection criteria, instead of a variable.


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
September 29, 2010, 10:52 AM
jseaburn
Looks like I was way off! Glad you were able to get the solution.


WebFOCUS 7.7.03
Linux / Universe Db
HTML/PDF/EXCEL/HTML Active
September 30, 2010, 09:45 AM
jgelona
Just to throw my 2 cents in, I prefer to the the WHERE field IN (&FILTERLIST) format instead of using OR.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
October 05, 2010, 01:29 PM
Phil_j2w
Thanks everyone. I've got the include file doing what I wanted. I also appreciate the alternative suggestions - but right now I'm sticking with the one process I was able to work out Smiler


WebFOCUS 7701
Windows 2008
All Formats