Caplin Trader 5.1.0

Class: module:ct-grid/filter/FieldFilterExpression

module:ct-grid/filter/FieldFilterExpression(name, operator, value, primaryFieldTypeopt, userInputtedValueopt, columnIdopt)

new module:ct-grid/filter/FieldFilterExpression(name, operator, value, primaryFieldTypeopt, userInputtedValueopt, columnIdopt)

Constructs a new FieldFilterExpression with the specified field name, operator and value.

Parameters:
Name Type Attributes Description
name String

The name of the field to be filtered.

operator String

The operator to be used for the filter. This must be one values defined by the module:ct-grid/filter/FieldFilterExpression/Operator enumeration.

value String

The value to be operated against.

primaryFieldType String <optional>

The type of the field, can be used to set custom filter types.

userInputtedValue String <optional>

The value the user typed into a filter input.

columnId String <optional>

The id of the column that this filter applies to.

Implements:
Throws:

module:ct-core/Error if the specified field name or value parameters are null or undefined, or if the specified operator is illegal.

Implementation of FilterExpression that represents a filter for a single field. When this is applied, only those records that match the specified criteria will be returned, those that don't are filtered out.

Field filter examples:

Operator Example
EQUAL Currency=USD Filters out all records that do not have a value of USD for their Currency field
NOT_EQUAL Currency!=USD Filters out all records that have a value of USD for their Currency field
GREATER_THAN Bid>100 Filters out all records that do not have a value greater than 100 for their Bid field
GREATER_THAN_OR_EQUAL Bid>=100 Filters out all records that do not have a value greater than or equal to 100 for their Bid field
LESS_THAN Bid<100 Filters out all records that do not have a value less than 100 for their Bid field
LESS_THAN_OR_EQUAL Bid<=100 Filters out all records that do not have a value less than or equal to 100 for their Bid field
REGULAR_EXPRESSION Currency~^(USD|EUR)$ Filters out all records that do not have a value of USD or EUR for their Currency field
CASE_INSENSITIVE_REGULAR_EXPRESSION Issuer#.*Gov.* Filters out all records that do not have a value that contains the text Gov, regardless of case, for their Issuer field

Members

(static) Operator.CASE_INSENSITIVE_REGULAR_EXPRESSION :String

Operator used to check that a string field matches a particular regular expression where an exact case match is not necessary.

The value of this operator is '#'.

Type:
  • String

(static) Operator.EQUAL :String

Operator used to check for an exact match between a field and a value. This can be used for both string and numeric based values.

The value of this operator is '='.

Type:
  • String

(static) Operator.GREATER_THAN :String

Operator used to check that a numeric field is greater than a particular value.

The value of this operator is '>'.

Type:
  • String

(static) Operator.GREATER_THAN_OR_EQUAL :String

Operator used to check that a numeric field is greater than or equal to a particular value.

The value of this operator is '>='.

Type:
  • String

(static) Operator.LESS_THAN :String

Operator used to check that a numeric field is less than a particular value.

The value of this operator is '<'.

Type:
  • String

(static) Operator.LESS_THAN_OR_EQUAL :String

Operator used to check that a numeric field is less than or equal to a value.

The value of this operator is '<='.

Type:
  • String

(static) Operator.NOT_EQUAL :String

Operator used to check that a field does not match a particular value. This can be used for both string and numeric based values.

The value of this operator is '!='.

Type:
  • String

(static) Operator.NUMERIC_EQUAL :String

Operator used to check for a numeric match between a field and a value. This can be used for numeric value only, and unlike a normal equals, entering 5.000 will match a value of 5, whereas it won't with the generic equals operator.

The value of this operator is '=='.

Type:
  • String

(static) Operator.NUMERIC_NOT_EQUAL :String

Operator used to check for a numeric match between a field and a value not to be equal. This can be used for numeric value only, and unlike a normal equals, entering 5.000 will match a value of 5, whereas it won't with the generic equals operator.

The value of this operator is '!=='.

Type:
  • String

(static) Operator.REGULAR_EXPRESSION :String

Operator used to check that a string field matches a particular regular expression.

The value of this operator is '~'.

Type:
  • String

(static) Operator.TEXT_GREATER_THAN :String

Operator used to check that a text field is greater than a particular value.

The value of this operator is 'gt'. Its RTTP State is the field name prefixed by 'text:' and an operator of '>'.

Type:
  • String

(static) Operator.TEXT_GREATER_THAN_OR_EQUAL :String

Operator used to check that a text field is greater than or equal to a particular value.

The value of this operator is 'ge'. Its RTTP State is the field name prefixed by 'text:' and an operator of '>='.

Type:
  • String

(static) Operator.TEXT_LESS_THAN :String

Operator used to check that a text field is less than a particular value.

The value of this operator is 'lt'. Its RTTP State is the field name prefixed by 'text:' and an operator of '<'.

Type:
  • String

(static) Operator.TEXT_LESS_THAN_OR_EQUAL :String

Operator used to check that a text field is less than or equal to a particular value.

The value of this operator is 'le'. Its RTTP State is the field name prefixed by 'text:' and an operator of '<='.

Type:
  • String

Methods

(static) getOperatorForFieldKey(fieldKey) → {String}

Returns the FieldFilterExpression operator that relates to the given key. This is a compatibility function to provide a mapping between operators and GridColumnFilter filter names.

Parameters:
Name Type Description
fieldKey String

The filter key to map

Returns:

The FieldFilterExpression operator

Type
String

(static) isValidFieldKey(fieldKey) → {boolean}

Indicates whether the given key maps to a valid FieldFilterExpression operator.

Parameters:
Name Type Description
fieldKey String

The filter key to check

Returns:

True if the key is valid, false otherwise

Type
boolean

getColumnId() → {String}

Returns the id of the column that this FieldFilterExpression applies to.

Returns:

The column id.

Type
String

getFieldName() → {String}

Gets the field name which this filter applies to

Returns:

The field that this filter applies to

Type
String

getFilterKey() → {String}

Returns a textual key that represents the operator used by this expression.

Returns:

The key that represents this expression's operator

Type
String

getOperator() → {String}

Returns the operator

Returns:

The operator for this FieldFilterExpression

Type
String

getRttpState()

Gets the serialized representation of this FieldFilterExpression which is understood by the Container Filtering Module used by Transformer.

Implements:
Returns:

String A serialized representation of this expression.

getSerializedState(indent) → {String}

Gets the XML representation of this FieldFilterExpression that will be used to save it within a serialized component and/or layout.

Parameters:
Name Type Description
indent String

The number of characters the caller would like the expression to indent the XML it returns to make it easily human readable.

Implements:
Returns:

An XML representation of this expression.

Type
String

getUserInputtedValue() → {String}

Returns the value the user typed into the filter input box if this filter was created by user input. A RegExp string may be converted from what is seen in the GUI to a string containing ^.*& etc and the grid on deserializing will need the original value to place into the input box, this method provides it.

Returns:

The user inputted value for this FieldFilterExpression.

Type
String

getValue() → {String}

Returns the value

Returns:

The value for this FieldFilterExpression

Type
String

isMutuallyExclusiveWith(filterExpression) → {boolean}

Indicates whether this filter is mutually exclusive with the given filter. Filters are mutually exclusive if they both share a mutually exclusive operator. The mutually exclusive operators are LESS THAN (OR EQUAL), GREATER THAN (OR EQUAL), EQUAL and NOT EQUAL.

Parameters:
Name Type Description
filterExpression module:ct-grid/filter/FieldFilterExpression

The filter to compare with this one

Returns:

true if the filters have mutually exclusive operators, false otherwise

Type
boolean

matchesFilterKey(filterName) → {boolean}

Indicated whether this FieldFilterExpression matches the filter name given. This is for backwards compatibility with GridColumnFilters.

Parameters:
Name Type Description
filterName

The filter name to check

Returns:

true if this filter matches, false otherwise

Type
boolean

setValue(value)

Sets the value

Parameters:
Name Type Description
value

The new value for the filter

toMap() → {Object}

Construct map representing the filter. Used by InputControls

Implements:
Returns:

A map with low/high/regex/not/numberNot/value

Type
Object

toString() → {String}

Gets a text representation of the field filter expression.

Returns:

A text representation of the expression.

Type
String