company logo

ControlContext :: setFilter - Activate instance filter

Instance filters can be activated by setting a filter condition or activating filtering explicitly. When filters are activated, filling controls with data runs slower than without activated filters.

Usually, filters are set for list (trees and tables) and drop list controls in order to display a subset of items available in the data source.

Implementation overview

Implementation details

  1. Using context filter
    ControlContext  :: setFilter ( bool bEnable )

    Context filter might be implemented by overloading the doBeforeDataSet() handler or implementing an appropriate action. In order to activate context filters, the function should be called in the doAfterOpen() handler passing true in bEnable.

    • bEnable - Enable resource

      In order to enable the referenced resource true should be passed. Passing false will disable the resource.

  2. to list
  3. Filter by expression
    ControlContext  :: setFilter ( odaba::String sExpression )

    The expression passed in sExpression is set as filter condition in the property handle in order toselect instances from a collection. Since this may influence other controls referring to the same data source, filters should be set for fields (lists), that use a copy property handle (data source definition in the resource database).

    In order to reset the current filter condition, an empty string might be passed in vExpression. When deactivating an expression, the filter feature is disabled. To re-activate context filter, you must call setFilter(true).

    • sExpression - OSI inline expression

      An inline expression can be passed as operand (something like a + b) or as complete expression. As operand, an expression may contain any expression, which is allowed in a statement, but no semicolon must be appended at the end.

      Complete expressions include expression header (optional) and may include different sections in the expression body which is enclosed in { ... }.

      In contrast to class expressions, inline expressions are not defined explicitly as class expressions but passed as strings to the application at run-time.

      In order to pass no expression, an empty string ( String() ) has to be passed.

  4. to list