Creating Table to Hold Filters 

 

Saving a Filter to the Database

   1.  Verify that the ftable is filtered
Check for wwFilterDlg..FieldInfo.Count  >0
The FIELDINFO property is a TList of type TwwFieldInfo that contains a list of the Filters that are active in a TwwFilterDialog Component. 
 
    2.  Ensure that the table holding the filters is open   
    3.  Store the Filter FieldInfo in a StringList
   4.  Store the StringList into a Memo field 
 
   5.  Insert a new record into the Filter Table
 
   6.  Set the Table Blob Field FILTTEXT to the contents of the Memo field
 
   7.  Allow the user to Name the filter and set other info
 

The SaveFilter Procedure

 

Loading a Filter From the Table 

 
  1.  Allow use to select desired filter
  2. Assign Filter Info from Table record to temporary TStringList
  3. Clear the current filter
  4. Load the current filter with selected data
  5. Make the filter active
 

 The LoadFilter Procedure

   

Clearing a Filter 

 

The ClearFilter Procedure

Notes:
  • Filter Dialog MUST be in same Data Module as DataSource Component
  • FilterMethod = dbQueryMode gave me the best performance.  Remote filtering performed by modifing the query where clause.