Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED]Maximum Filter
Go
New
Search
Notify
Tools
Reply
  
[CLOSED]Maximum Filter
 Login/Join
 
Guru
posted
Is there is a maximum number of filters allowed using
1.) Using a sngle "OR " string
2.) Using a single in-list

Thanks in advance to the Focus Nation. Smiler

This message has been edited. Last edited by: <Emily McAllister>,


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
 
Posts: 239 | Location: Orlando, FL / Baltimore, MD | Registered: May 06, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
With Oracle as a DB the limit on IN is 1000 items


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6104 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
With Oracle as a DB the limit on IN is 1000 items

Same goes for MS SQL

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5601 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Guru
posted Hide Post
IN LIST - great to know

But how many "OR(s)" are allowed? Punctuation corrections are welcome Cool


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
 
Posts: 239 | Location: Orlando, FL / Baltimore, MD | Registered: May 06, 2003Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Apparently the number of OR's for TABLE requests does not have a (documented) limit. The total lengths of several TABLE-request expressions do have a limit (of 64kB) though, see: http://infocenter.informationb.../source/topic313.htm

With that in mind, any limit in the number of OR's or IN-list items is most probably decided by external factors; primarily the database you are querying and secondary the database adapter you're using (check the relevant adapter documentation for specifics).

As people stated already, for certain RDBMS's there are known limitations in the number of items in IN-lists. For the record, OR's usually get translated to IN-lists when converted to SQL, but that depends on the adapter.

One alternative when you're querying an RDBMS is to create a temporary table on the RDBMS with your lookup-items and perform a JOIN or WHERE IN (subselect) at the database side[1]. There are HOLD FORMAT's for that.

Ad 1. The limit on number of IN-list items is usually only applied to hard-coded lists within the query-string, but not for result sets from subselects and the like.

Finally, if you want to know if there is a limit to the number of OR's at your end, that's fairly easy to test!
TABLE FILE FOO
PRINT BAR
WHERE BAR EQ 1
-REPEAT :OROROR FOR &O FROM 2 TO 5000;
 OR &O
-:OROROR
;
END


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1643 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
I discovered what I think is a weakness of the WebFOCUS SQL adapter. I have a Tree control from which a user can select up to 1200 values. I hand-crafted a beautiful piece of code to create a WHERE statement in which I separate the first 1000 selected values from the rest. When run in SQL, this works well. When run in WebFOCUS, the SQL adapter undoes the OR and creates only one set of values, which causes a SQL error as there are over 1000 values. It is my opinion that the SQL adapter is doing the opposite of what it should be doing. The SQL adapter should automatically separate the values into batches of 1000 values.

WHERE column IN ('val1', 'val2', ...) OR column IN ('val1001', 'val1002', ...)


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
WHERE column IN ('val1', 'val2', ...) OR column IN ('val1001', 'val1002', ...)


Seriously, that works? How reliable is this approach? It defies reason that RDBMSes that refuse to accept SQL statements with IN-lists with more than 1000 items would accept multiple IN-lists that still total more than 1000 items...

A good query optimizer would probably combine such IN-lists into one and could thus figure out what you're trying to do here - and refuse.

Then again, those arbitrary limitations on the size of IN-lists defy reason as well, so it's probably a matter of picking the lesser evil.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1643 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
There are several ways to format the SQL to ensure performance. My example code might take a performance hit, but that was not my concern...


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Adding this SET statement to your query will increase the number of values permitted in an IN FILE clause when used with SQL Server. I don't know if it has any effect with Oracle or other relational DBMS's.
ON TABLE SET NATVFLG 256


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED]Maximum Filter

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.