psSQLFilter - DataDictionary
Defines Data Dictionary SQL filter string to be applied
Type: Property
Access: Read/Write
Data Type: String
Parameters: None
Syntax
Property String psSQLFilter
| Access Type | Syntax |
|---|---|
| Read Access: | Get psSQLFilter to StringVariable |
| Write Access: | Set psSQLFilter to StringVariable/Value |
Description
psSQLFilter defines the DataDictionary (DD) SQL filter string to be applied and works in much the same way the DF_File_SQL_Filter attribute works. This is only applied if pbUseDDSQLFilters is True.
If pbUseDDSQLFilters is True, pbApplyGlobalSQLFilters is False, and psSQLFilter is empty, then explicitly no SQL filter is applied. If a table level filter exists and is active, it will be not used in the find.
You can use some of the SQL string helper functions such as SQLStrFileFieldName, SQLStrAppend and SQLStrLike to help assemble your SQL filter string.
We recommend always surrounding filters containing string constants by parentheses to ensure they are executed correctly if combined with global SQL filters.
psSQLFilter is only applied to the (main) table find.
The default value is "".
Applying SQL Filters Dynamically
To apply or change an SQL filter dynamically, set psSQLFilter and call ApplySQLFilter.
Procedure DoSearch String sSearch
Set psSQLFilter of oCustomer_DD to ("Customer.Name LIKE '%" + sSearch + "%'")
Set pbUseDDSQLFilters of oCustomer_DD to True
Send ApplySQLFilter of oCustomer_DD
End_Procedure
If dynamically filtering a cWebGrid or cWebList using SQL filters, also call FindFromTop after applying the filters.
Procedure DoSearch String sSearch
Set psSQLFilter of oCustomer_DD to ("Customer.Name LIKE '%" + sSearch + "%'")
Set pbUseDDSQLFilters of oCustomer_DD to True
// after applying a filter, refill the list from the top
Send FindFromTop of oList
End_Procedure
See Also