Grid - Selection criteria vs. Custom Sql?
-
- Profound User
- Posts: 83
- Joined: Sun Oct 03, 2010 8:45 am
- First Name: Mike
- Last Name: Geldert
- Company Name: Stonriver
- Country: Angola
- Contact:
Grid - Selection criteria vs. Custom Sql?
Whats the difference between these two properties as they pertain to a grid that you're binding to a database?
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: Grid - Selection criteria vs. Custom Sql?
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:
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:
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.
The generated query looks like this:
Code: Select all
SELECT ["database fields"] FROM ["database file"] WHERE ["selection criteria"] ORDER BY ["order by"]
Code: Select all
ACTIVE = 'Y'
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.
Who is online
Users browsing this forum: No registered users and 1 guest