Focal Point
Maximum WHERE's and OR's

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

October 19, 2007, 11:20 AM
thefoz
Maximum WHERE's and OR's
Hi All.

Is there a maximum number of WHERE and OR clauses I can put in my criteria?

I have a situation where there could be the posibility of my exec receiving hundreds of account numbers from an ASP front end.

Many Thanks

Developer Studio 7.6.1 SQL Server 2005


DevStudio 7.6.1. SQL Server 2005
October 19, 2007, 11:33 AM
Leah
This, assume you are going to use the in file option of where.

Technical Documentation search

--------------------------------------------------------------------------------
Top of page
--------------------------------------------------------------------------------


Reference: Usage Notes for Reading Values From a File
In order to read selection criteria from a file, the file must comply with the following rules:

Each value in the file must be on a separate line.
For IF, more information can appear on a line, but only the first data value encountered on the line is used.

The selection value must start in column one.
The values are assumed to be in character format, unless the file name is HOLD, and numeric digits are converted to internal computational numbers where needed (for example, binary integer).
For IF, the total of all files can be up to 32,767 literals, including new line and other formatting characters. Lower limits apply to fixed sequential and other non-relational data sources.
For WHERE, the file can be approximately 16,000 bytes. If the file is too large, an error message displays.
For WHERE, alphanumeric values with embedded blanks or any mathematical operator (-, +, *, /) must be enclosed in single quotation marks.
For WHERE, when a compound WHERE phrase uses IN FILE more than once, the specified files must have the same record formats.
If your list of literals is too large, an error is displayed.

For IF, sets of file names may be used, separated by the word OR. Actual literals may also be mixed with the file names. For example:
IF fieldname operator (filename) OR literal...etc...


Leah
October 19, 2007, 03:07 PM
Francis Mariani
If you have that many accounts to select, use WHERE IN FILE file-name making sure that the file falls within the restrictions Leah posted. As well, in my experience, when the WebFOCUS code gets translated to SQL, SQL usually has a limit of 1000 entries in a WHERE statement: WHERE ACCOUNT_NBR IN (123, 456, 789, ...);


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, 2007, 04:28 AM
thefoz
Thanks for your replies. I shall give those some thought.

The way that I could be getting the Customer Account Numbers is through amper variables i.e

&CAN0 = 50 -* The number of account numbers
&CAN1 = 123456
&CAN2 = 1236548
....
&CAN50 = 9876543

Is there any limit on these?

Many Thanks


DevStudio 7.6.1. SQL Server 2005
October 29, 2007, 05:58 AM
GamP
The answer to that question is that there is a maximum of 1024 &variables.
But, this is the absolute maximum, including the system &vars (25 of them), and not counting &vars that exceed 32K in length.

So, the answer is not a fixed number, but rather it can be calculated using the following formula:

1024 - <25 for FOCUS> - <# of variables that exceed 32k> = # variables available.

This information is valid for WebFOCUS version 533, it may have been increased already....


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
October 29, 2007, 06:06 AM
thefoz
Thanks for that GamP. We've tested up to 500 amper variables being passed and everything seemed to work ok. Its good to know that we've got alot of scope to work with.

Many Thanks


DevStudio 7.6.1. SQL Server 2005
October 29, 2007, 05:27 PM
Trav
Another possibility to consider would be to get those values inserted into a table on your database and join to that table in your report...

Depending on your situation this may or may not be feasible.



Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF