Page 1 of 1

Grid - Selection criteria vs. Custom Sql?

Posted: Fri Jan 27, 2012 11:53 am
by leatherlips
Whats the difference between these two properties as they pertain to a grid that you're binding to a database?

Re: Grid - Selection criteria vs. Custom Sql?

Posted: Fri Jan 27, 2012 12:07 pm
by David
The "selection" criteria is used in conjunction with the "database file", "database fields", and "order by" properties to automatically generate an SQL query to fetch the data.

The generated query looks like this:

Code: Select all


SELECT ["database fields"] FROM ["database file"] WHERE ["selection criteria"] ORDER BY ["order by"]

So, "selection criteria" is used as the WHERE clause in the generated query. For example, let's say you wanted to select only those records where a field named "ACTIVE" in your file is equal to 'Y'. You would put this into the "selection criteria" property:

Code: Select all


ACTIVE = 'Y'

On the other hand...

The "custom sql" property is used INSTEAD of all the other properties. Using this property, you specify the entire SQL query yourself. You might use this to get a more complex query, such as one that joins multiple files.