At 01:46 PM 2/18/2003, you wrote:
On Tue, 18 Feb 2003 13:24:22 -0600, Fogelson, Steve wrote:

>I guess I was wondering how the "Incl. Empty" option in the "criteria"
of a
>"search" action could be related to a DBMS. I understand this option
(if set
>to false) to not include a criteria if null.

No, those settings deal with data that comes back after a query
against the database.

That is incorrect.

The "Include If Empty" option in the Criteria tab of a Search action definitely has an impact on the SQL sent to the server. Yes, it may affect the results you see, but only because it changes the SQL SELECT statement sent to the DBMS.


Take a simple example. Imagine you have a form with one input field called ID. You have a table in your database with two columns: "TheID", and "Name". You've set up a Search action to return the TheID and Name columns from your table. You have set the Criteria tab of the Search action to include the TheID = <@ARG ID>.

Now, imagine that the user doesn't enter a value in the ID input field. That is, the ID argument IS EMPTY.

If the Include If Empty option is set to False, the SQL sent to the database will be:

SELECT t1.TheID, t1.Name FROM MyTable t1

Notice that there is no WHERE clause. That's because the criteria wasn't included because the argument was empty.

If you set Include If Empty to True, the SQL will be:

SELECT t1.TheID, t1.Name FROM MyTable t1 WHERE t1.TheID IS NULL

Now, the criteria has been included, even though the value (<@ARG ID>) is empty.


There is more information on this topic in the manuals.

HTH,

Eric
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
with unsubscribe witango-talk in the message body

Reply via email to