User Tools

Site Tools


prop_sqlfilter_1.htm
Navigation:  SQL Driver Properties(General) >====== PROP:SQLFilter ====== Previous pageReturn to chapter overviewNext page

NoteBox.jpg

Supported for backward compatibility; this statement should be replaced by the more versatile SQL() statement.

blk2blue.jpg

You can use PROP:SQLFilter to filter your VIEWs using native SQL code rather than Clarion code. This is only applicable when using an SQL file Driver (such as the ODBC, Scalable SQL, Sybase, or Oracle drivers). If the first character of the PROP:SQLFilter expression is a plus sign (+), the PROP:SQLFilter expression is appended to any existing PROP:Filter expression and both are used. Omitting the plus sign replaces the existing PROP:Filter expression with the PROP:SQLFilter.

When you use PROP:SQLFilter, the SQL filter is passed directly to the server. As such it cannot contain the names of tables, variables, or functions that the server is not aware of; that is the filter expression must be valid SQL syntax with valid SQL table and column names. For example:

View{PROP:SQLFilter} = 'Date = TO_DATE(01-MAY-1996,DD-MON-YYYY)'

or

View{PROP:SQLFilter} = 'StrField LIKE AD%'

Note that the SQL Accelerator incorporates the PROP:SQLFilter expression into the WHERE clause of a generated SELECT statement. The generated SELECT statement may reference one or more tables by aliases. If your filter also references tables (e.g., Customer.Name <; 'T'), you must use the same alias names generated by the SQL Accelerator. By default, the SQL Accelerator uses the next letter of the alphabet as the alias name. For example, the Accelerator uses 'A' as the alias for the first table in the generated SELECT statement, then 'B' for the next table, and so on. You can use PROP:Alias to control the alias names generated by the SQL Accelerator. See PROP:Alias for more information.

Combining VIEW Filters and SQL Filters

When you use PROP:SQLFilter, the SQL filter may replace any filter specified for the VIEW, or it may be in addition to a filter specified for the VIEW. Prefix the SQL filter with a plus sign (+) to append the SQL filter to the existing VIEW filter.

For example:

View{PROP:SQLFilter} = '+ StrField LIKE AD%'   !Add additional filter criteria

When you append the SQL filter by using the plus sign, the end result of the filtering process is (View Filter) AND (SQL Filter).

Omit the plus sign (+) to replace the Clarion filter with the SQL filter. When you replace the Clarion filter with the SQL filter by omitting the plus sign, the logical end result of the filtering process is simply (SQL Filter).

See Also: PROP:Filter ,PROPSQL

prop_sqlfilter_1.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1