Fuzzy database filtering

To use the filtering functionality for a fuzzy database in script, the column used for filtering must have the Filter option selected in the Import Settings for Database window. The data records from the data records from the database can then be limited by applying a filter text so that only data records are used in the search that have that specific value. Filtering is available for remote fuzzy databases only.

You can configure the filtering constraint that is applied to the fuzzy search using a script. The CsCDatabase object has the ability to add, remove, and clear a database filter.

The following functions are available when you want to use the add, remove, and clear functionality for filters.


void AddFilteringItem(string FieldName, string filterText);
void RemoveFilteringItem(string FieldName);
void GetFilteringItem(uint Index, out string pFieldName, out string pFilterText);
uint GetFilteringItemCount();
void ClearFilteringItems();

You can use the above functions at any time, in script. The filtering constraint modifications are saved in memory and used by each fuzzy search. This occurs as long as a clear function is not called or the project is reloaded. For example,

Private Sub Document_BeforeExtract(ByVal pXDoc As CASCADELib.CscXDocument)
   Dim database As CscDatabase
   Set database = Project.Databases.ItemByName("FilteringDatabase")
   database.ClearFilteringItems()
   database.AddFilteringItem("Column Name 1", "expected value 1")
   database.AddFilteringItem("Column Name 2", "expected value 2")
End Sub