Constructor
new module:caplin/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:caplin/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:caplin/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 |
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.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. 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:caplin/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.
- Implements:
Returns:
A text representation of the expression.- Type
- String