This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Home > Class Reference > %SYS namespace > %iKnow.Filters.SqlFilter

%iKnow.Filters.SqlFilter

class %iKnow.Filters.SqlFilter extends %iKnow.Filters.Filter

Sample filter implementation restricting sources based on a SQL query result. This SQL query can select from any regular SQL table or view accessible from the namespace the filter is instantiated from. The query should select sources through returning either of the following as result columns (case sensitive!):

Filter parameters:

  1. domainId As %Integer
  2. sqlQuery As %String - query to filter by

WARNING: these filters are not invalidated automatically if the values in the tables accessed by the supplied SQL query change. It is up to the user to decide, based on the specifics of the environment, whether filter instances of this class can be cached meaningfully (see the useCache parameter of Initialize()) and/or should be invalidated explicitly (see Invalidate() or ClearCachedFilter()).

Property Inventory (Including Private)

Method Inventory (Including Private)

Properties (Including Private)

property SqlQuery as %String;
Property methods: SqlQueryDisplayToLogical(), SqlQueryGet(), SqlQueryIsValid(), SqlQueryLogicalToDisplay(), SqlQueryLogicalToOdbc(), SqlQueryNormalize(), SqlQuerySet()

Methods (Including Private)

private method %OnNew(pDomainId As %Integer, pSqlQuery As %String) as %Status
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

private method BuildSourceFilter(maxOffset As %Integer) as %Status
Inherited description:

This is the primary method that needs to be implemented by an actual %iKnow.Filters.Filter subclass to translate the abstract filter criteria the subclass addresses into a bitstring based on Source IDs. The subclass' implementation of this method should use SetSourceBits() for this purpose, setting the requested bitstrings for each offset up to maxOffset.

private classmethod RestoreFilterFromStringInternal(filterParams As %String) as %iKnow.Filters.Filter
Inherited description:

Default implementation, with the filterParams corresponding to all %New() arguments. See also RestoreFilterFromString().

method ToString() as %String
Inherited description:

Subclasses should implement this method to build a string representation of the filter instance. It should start with the filter class name, followed by a pipe (|) character and then a string representation that can be interpreted by its RestoreFilterFromStringInternal() implementation.

Inherited Members

Inherited Properties (Including Private)

Inherited Methods (Including Private)

FeedbackOpens in a new window