Class Criterion
- All Implemented Interfaces:
HasHandlers
- Direct Known Subclasses:
AdvancedCriteria
A criterion is part of the definition of an AdvancedCriteria object, which is used to filter records according to search criteria.
A
criterion consists of an operator and typically a fieldName from a Record and a value to compare to. However some operators either don't require a value
(eg, isNull) or act on other criteria rather than directly on a Record's fields (eg,
the "and" and "or" logical operators). Also, it is possible to specify a fieldQuery instead of a fieldName and/or a valueQuery instead of a value
A shortcut form is also
allowed where only fieldName and value values are provided. In this case the
operator is assumed to be "equals".
- See Also:
-
Field Summary
Fields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties -
Constructor Summary
ConstructorsConstructorDescriptionCriterion(JavaScriptObject jsObj) Criterion(OperatorId operator) Criterion(OperatorId operator, Criterion[] criterias) Criterion(String fieldName, OperatorId operator) Criterion(String fieldName, OperatorId operator, RelativeDate value) Constructor for Criterion with fieldName, operator and RelativeDate value.Criterion(String fieldName, OperatorId operator, RelativeDate start, RelativeDate end) Constructor for Criterion with fieldName, operator, start and end RelativeDate values.Criterion(String fieldName, OperatorId operator, Boolean value) Constructor for Criterion with fieldName, operator and value.Criterion(String fieldName, OperatorId operator, Boolean[] value) Criterion(String fieldName, OperatorId operator, Float value) Constructor for Criterion with fieldName, operator and value.Criterion(String fieldName, OperatorId operator, Float[] value) Criterion(String fieldName, OperatorId operator, Float start, Float end) Constructor for Criterion with fieldName, operator, start and end values.Criterion(String fieldName, OperatorId operator, Integer value) Constructor for Criterion with fieldName, operator and value.Criterion(String fieldName, OperatorId operator, Integer[] value) Criterion(String fieldName, OperatorId operator, Integer start, Integer end) Constructor for Criterion with fieldName, operator, start and end values.Criterion(String fieldName, OperatorId operator, Long value) Constructor for Criterion with fieldName, operator and value.Criterion(String fieldName, OperatorId operator, Long[] value) Criterion(String fieldName, OperatorId operator, Long start, Long end) Constructor for Criterion with fieldName, operator, start and end values.Criterion(String fieldName, OperatorId operator, String value) Constructor for Criterion with fieldName, operator and value.Criterion(String fieldName, OperatorId operator, String[] value) Criterion(String fieldName, OperatorId operator, String start, String end) Constructor for Criterion with fieldName, operator, start and end values.Criterion(String fieldName, OperatorId operator, Date value) Constructor for Criterion with fieldName, operator and value.Criterion(String fieldName, OperatorId operator, Date[] value) Criterion(String fieldName, OperatorId operator, Date start, Date end) Constructor for Criterion with fieldName, operator, start and end values. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new criteria.voidAdds a new criteria.voidaddCriteria(String field) This method callsaddCriteria(String, OperatorId, value), passing "EQUALS" as the OperatorId and Boolean.TRUE as value.voidaddCriteria(String field, OperatorId op, Boolean value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, OperatorId op, Boolean[] value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, OperatorId op, Float value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, OperatorId op, Float[] value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, OperatorId op, Integer value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, OperatorId op, Integer[] value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, OperatorId op, String value) Creates a Criterion and callsaddCriteria(Criterion).voidaddCriteria(String field, OperatorId op, String[] value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, OperatorId op, Date value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, OperatorId op, Date[] value) This method is similar toaddCriteria(String, OperatorId, String).voidaddCriteria(String field, Boolean value) This method is similar toaddCriteria(String, String).voidaddCriteria(String field, Boolean[] value) This method is similar toaddCriteria(String, String).voidaddCriteria(String field, Float value) This method is similar toaddCriteria(String, String).voidaddCriteria(String field, Float[] value) This method is similar toaddCriteria(String, String).voidaddCriteria(String field, Integer value) This method is similar toaddCriteria(String, String).voidaddCriteria(String field, Integer[] value) This method is similar toaddCriteria(String, String).voidaddCriteria(String field, String value) This method callsaddCriteria(String, OperatorId, String), passing "EQUALS" as the OperatorId.voidaddCriteria(String field, String[] value) This method is similar toaddCriteria(String, String).voidaddCriteria(String field, Date value) This method is similar toaddCriteria(String, String).voidaddCriteria(String field, Date[] value) This method is similar toaddCriteria(String, String).voidFor a Criterion that usesOperatorId.ANDorOperatorId.OR, add an additional Criterion to the list of subcriteria to be evaluated.Returns an AdvancedCriteria derived from this Criteria object.voidbuildCriterionFromList(OperatorId operator, Criterion[] criterias) For a criterion with an operator that acts on other criteria (eg "and", "or"), a list of sub-criteria that are grouped together by the operator.Name of the field in eachRecordthat this criterion applies to.A subquery to use instead of afieldName.Operator this criterion applies.static CriteriongetOrCreateRef(JavaScriptObject jsObj) Retrieves the specified value for this criterion.Retrieves the specified value for this criterion.Retrieves the specified value for this criterion.final IntegerSynonym ofgetValueAsInteger().int[]Retrieves the specified value for this criterion.Retrieves the specified value for this criterion.Retrieves the specified value for this criterion.String[]Retrieves the specified value for this criterion.WhereverDynamicCriteriaare supported,valuePathcan be specified as a path in the currentCanvas.ruleScopeas an alternative to setting a fixedvalue.A subquery to use instead of avalue.static final booleaninstanceOf(Object object) voidsetCriteria(Criterion... criteria) For a criterion with an operator that acts on other criteria (eg "and", "or"), a list of sub-criteria that are grouped together by the operator.voidsetCustomOperator(String operator) Specifies a "custom" operator to this criterion.setFieldName(String fieldName) Name of the field in eachRecordthat this criterion applies to.setFieldQuery(AdvancedCriterionSubquery fieldQuery) A subquery to use instead of afieldName.setOperator(OperatorId operator) Operator this criterion applies.setValuePath(String valuePath) WhereverDynamicCriteriaare supported,valuePathcan be specified as a path in the currentCanvas.ruleScopeas an alternative to setting a fixedvalue.setValueQuery(AdvancedCriterionSubquery valueQuery) A subquery to use instead of avalue.voidMethods inherited from class com.smartgwt.client.data.Criteria
addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, convertToCriteriaArray, getValues, isAdvancedMethods inherited from class com.smartgwt.client.core.DataClass
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
-
Constructor Details
-
Criterion
public Criterion() -
Criterion
-
Criterion
-
Criterion
-
Criterion
-
Criterion
-
Criterion
-
Criterion
-
Criterion
Constructor for Criterion with fieldName, operator and value.- Parameters:
fieldName- the field nameoperator- the operatorvalue- the value
-
Criterion
Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator isOperatorId.BETWEENorOperatorId.BETWEEN_INCLUSIVE- Parameters:
fieldName- the field nameoperator- the operatorstart- the start valueend- the end value
-
Criterion
Constructor for Criterion with fieldName, operator and value.- Parameters:
fieldName- the field nameoperator- the operatorvalue- the value
-
Criterion
Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator isOperatorId.BETWEENorOperatorId.BETWEEN_INCLUSIVE- Parameters:
fieldName- the field nameoperator- the operatorstart- the start valueend- the end value
-
Criterion
Constructor for Criterion with fieldName, operator and value.- Parameters:
fieldName- the field nameoperator- the operatorvalue- the value
-
Criterion
Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator isOperatorId.BETWEENorOperatorId.BETWEEN_INCLUSIVE- Parameters:
fieldName- the field nameoperator- the operatorstart- the start valueend- the end value
-
Criterion
Constructor for Criterion with fieldName, operator and value.- Parameters:
fieldName- the field nameoperator- the operatorvalue- the value
-
Criterion
Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator isOperatorId.BETWEENorOperatorId.BETWEEN_INCLUSIVE- Parameters:
fieldName- the field nameoperator- the operatorstart- the start valueend- the end value
-
Criterion
Constructor for Criterion with fieldName, operator and RelativeDate value.- Parameters:
fieldName- the field nameoperator- the operatorvalue- the RelativeDate value
-
Criterion
Constructor for Criterion with fieldName, operator, start and end RelativeDate values. This constructor is only valid when the operator isOperatorId.BETWEENorOperatorId.BETWEEN_INCLUSIVE- Parameters:
fieldName- the field nameoperator- the operatorstart- the start valueend- the end value
-
Criterion
Constructor for Criterion with fieldName, operator and value.- Parameters:
fieldName- the field nameoperator- the operatorvalue- the value
-
Criterion
Constructor for Criterion with fieldName, operator and value. Note that JavaScript does not natively have an equivalent format to Java long (fixed point 64 bit). As such the value passed in will be converted to a double value for storage.- Parameters:
fieldName- the field nameoperator- the operatorvalue- the value
-
Criterion
Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator isOperatorId.BETWEENorOperatorId.BETWEEN_INCLUSIVE- Parameters:
fieldName- the field nameoperator- the operatorstart- the start valueend- the end value
-
Criterion
-
Criterion
-
Criterion
-
Criterion
-
Criterion
-
Criterion
-
-
Method Details
-
getOrCreateRef
-
setCriteria
For a criterion with an operator that acts on other criteria (eg "and", "or"), a list of sub-criteria that are grouped together by the operator.- Parameters:
criteria- New criteria value. Default value is null- Returns:
Criterioninstance, for chaining setter calls- See Also:
-
getCriteria
For a criterion with an operator that acts on other criteria (eg "and", "or"), a list of sub-criteria that are grouped together by the operator.- Returns:
- Current criteria value. Default value is null
- See Also:
-
setFieldName
Name of the field in eachRecordthat this criterion applies to. Not applicable for a criterion withsub-criteria. Can be specified as a dataPath to allow matching nested objects. Use '/' as delimiters for dataPath. SeedataPathfor more information.fieldQueryshortcutsfieldNamecan also be used to express a compact form of related-field filtering. If you set this property to the qualified name of a field on a related DataSource, it will be transformed into a basicAdvancedCriterionSubquery. For example, say you have anOrderdataSource, which has aforeign key relationto yourCustomerdataSource, and yourCustomerdataSource has a "region" field. If you wanted to fetch all Orders for Customers in the EMEA region, you could declare criteria like this:{fieldName: "Customer.region", operator: "equals", value: "EMEA"}This would be transformed into a subquery filter that would select only the records you want:{ fieldQuery: { dataSource: "Customer", queryOutput: "region" }, operator: "equals", value: "EMEA" }This transformation takes place before the filtering subsystem even sees the criteria, so declaring the shortcut form viafieldNameleads to exactly the same filtering behavior as if you specified the subquery directly as afieldQuerySee the
AdvancedCriterionSubqueryoverview linked above for more details of the extremely powerful subquery filtering options.- Parameters:
fieldName- New fieldName value. Default value is null- Returns:
Criterioninstance, for chaining setter calls- See Also:
-
getFieldName
Name of the field in eachRecordthat this criterion applies to. Not applicable for a criterion withsub-criteria. Can be specified as a dataPath to allow matching nested objects. Use '/' as delimiters for dataPath. SeedataPathfor more information.fieldQueryshortcutsfieldNamecan also be used to express a compact form of related-field filtering. If you set this property to the qualified name of a field on a related DataSource, it will be transformed into a basicAdvancedCriterionSubquery. For example, say you have anOrderdataSource, which has aforeign key relationto yourCustomerdataSource, and yourCustomerdataSource has a "region" field. If you wanted to fetch all Orders for Customers in the EMEA region, you could declare criteria like this:{fieldName: "Customer.region", operator: "equals", value: "EMEA"}This would be transformed into a subquery filter that would select only the records you want:{ fieldQuery: { dataSource: "Customer", queryOutput: "region" }, operator: "equals", value: "EMEA" }This transformation takes place before the filtering subsystem even sees the criteria, so declaring the shortcut form viafieldNameleads to exactly the same filtering behavior as if you specified the subquery directly as afieldQuerySee the
AdvancedCriterionSubqueryoverview linked above for more details of the extremely powerful subquery filtering options.- Returns:
- Current fieldName value. Default value is null
- See Also:
-
setFieldQuery
A subquery to use instead of afieldName. When you use afieldQueryinstead of afieldName, you are comparing the criterionvalueto the result of running a per-record subquery, rather than a field value found directly on the record. Note, it is also possible to specify both afieldQueryand avalueQuery.See the
subquery overviewfor more details of the criteria subquery feature, and examples of use.Note, if you specify both
fieldQueryandfieldNamein a criterion, we use thefieldNameand thefieldQueryis ignored.Note also that
fieldNamesupports a special shortcut syntax for declaring afieldQueryas a simple qualified reference to a related field. See thefieldNamedoc linked above for details- Parameters:
fieldQuery- New fieldQuery value. Default value is null- Returns:
Criterioninstance, for chaining setter calls- See Also:
-
getFieldQuery
A subquery to use instead of afieldName. When you use afieldQueryinstead of afieldName, you are comparing the criterionvalueto the result of running a per-record subquery, rather than a field value found directly on the record. Note, it is also possible to specify both afieldQueryand avalueQuery.See the
subquery overviewfor more details of the criteria subquery feature, and examples of use.Note, if you specify both
fieldQueryandfieldNamein a criterion, we use thefieldNameand thefieldQueryis ignored.Note also that
fieldNamesupports a special shortcut syntax for declaring afieldQueryas a simple qualified reference to a related field. See thefieldNamedoc linked above for details- Returns:
- Current fieldQuery value. Default value is null
- See Also:
-
setOperator
Operator this criterion applies.- Parameters:
operator- New operator value. Default value is null- Returns:
Criterioninstance, for chaining setter calls- See Also:
-
getOperator
Operator this criterion applies.- Returns:
- Current operator value. Default value is null
- See Also:
-
setValuePath
WhereverDynamicCriteriaare supported,valuePathcan be specified as a path in the currentCanvas.ruleScopeas an alternative to setting a fixedvalue.Note:
valuePathvs setting a path forfieldName:- use a path for
criterion.fieldNamewhen criteria will be matched against a nested data structure. - use
criterion.valuePathwhen the values used in filtering should be dynamically derived based on theCanvas.ruleScope. This does not imply that the criteria will be matched against a nested structure.
- Parameters:
valuePath- New valuePath value. Default value is null- Returns:
Criterioninstance, for chaining setter calls
- use a path for
-
getValuePath
WhereverDynamicCriteriaare supported,valuePathcan be specified as a path in the currentCanvas.ruleScopeas an alternative to setting a fixedvalue.Note:
valuePathvs setting a path forfieldName:- use a path for
criterion.fieldNamewhen criteria will be matched against a nested data structure. - use
criterion.valuePathwhen the values used in filtering should be dynamically derived based on theCanvas.ruleScope. This does not imply that the criteria will be matched against a nested structure.
- Returns:
- Current valuePath value. Default value is null
- use a path for
-
setValueQuery
A subquery to use instead of avalue. When you use avalueQueryinstead of avalue, you are comparing the values in the record field named in the criterionfieldNameto the result of running a per-record subquery, rather than a literal scalar value. . Note, it is also possible to specify both avalueQueryand afieldQuery.See the
subquery overviewfor more details of the criteria subquery feature, and examples of use.Note, if you specify both
valueQueryandvaluein a criterion, we use thevalueand thevalueQueryis ignored- Parameters:
valueQuery- New valueQuery value. Default value is null- Returns:
Criterioninstance, for chaining setter calls- See Also:
-
getValueQuery
A subquery to use instead of avalue. When you use avalueQueryinstead of avalue, you are comparing the values in the record field named in the criterionfieldNameto the result of running a per-record subquery, rather than a literal scalar value. . Note, it is also possible to specify both avalueQueryand afieldQuery.See the
subquery overviewfor more details of the criteria subquery feature, and examples of use.Note, if you specify both
valueQueryandvaluein a criterion, we use thevalueand thevalueQueryis ignored- Returns:
- Current valueQuery value. Default value is null
- See Also:
-
instanceOf
-
addCriteria
Adds a new criteria.If the present criteria operation is "and", the new criteria is appended to the criteria list.
Otherwise, the existing criteria is replaced with an "and" criteria, with two sub-criteria: the existing criteria, and the passed criteria.
Note that if the existing criteria was empty (as would happen if new AdvancedCriteria() were called with no arguments), an "and" operator will still be introduced, but the passed criteria will be the only sub-criteria.
To add an additional Criterion when using the "or" operator, use
appendToCriterionList(com.smartgwt.client.data.Criterion).- Parameters:
c- the passed criteria object
-
addCriteria
Adds a new criteria. If the passed criteria is a simple Criteria or Criterion, it will turn into AdvancedCriteria, and will be added to the existent criteria.- Overrides:
addCriteriain classCriteria- Parameters:
c- the passed criteria object
-
addCriteria
This method callsaddCriteria(String, OperatorId, value), passing "EQUALS" as the OperatorId and Boolean.TRUE as value.- See Also:
-
addCriteria
This method callsaddCriteria(String, OperatorId, String), passing "EQUALS" as the OperatorId.- Overrides:
addCriteriain classCriteria- See Also:
-
addCriteria
This method is similar toaddCriteria(String, String).- Overrides:
addCriteriain classCriteria
-
addCriteria
This method is similar toaddCriteria(String, String).- Overrides:
addCriteriain classCriteria
-
addCriteria
This method is similar toaddCriteria(String, String).- Overrides:
addCriteriain classCriteria
-
addCriteria
This method is similar toaddCriteria(String, String).- Overrides:
addCriteriain classCriteria
-
addCriteria
This method is similar toaddCriteria(String, String).- Overrides:
addCriteriain classCriteria
-
addCriteria
This method is similar toaddCriteria(String, String).- Overrides:
addCriteriain classCriteria
-
addCriteria
This method is similar toaddCriteria(String, String).- Overrides:
addCriteriain classCriteria
-
addCriteria
This method is similar toaddCriteria(String, String). -
addCriteria
This method is similar toaddCriteria(String, String).- Overrides:
addCriteriain classCriteria
-
addCriteria
Creates a Criterion and callsaddCriteria(Criterion). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
addCriteria
This method is similar toaddCriteria(String, OperatorId, String). -
buildCriterionFromList
-
appendToCriterionList
For a Criterion that usesOperatorId.ANDorOperatorId.OR, add an additional Criterion to the list of subcriteria to be evaluated. -
setCustomOperator
Specifies a "custom" operator to this criterion.- Parameters:
operator- the operator
-
markAdvancedCriteria
public void markAdvancedCriteria() -
unmarkAdvancedCriteria
public void unmarkAdvancedCriteria() -
getValueAsString
Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing {@link #getCriteria(),sub criteria}.- Returns:
-
getValueAsInt
Synonym ofgetValueAsInteger(). -
getValueAsInteger
Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing {@link #getCriteria(),sub criteria}.- Returns:
-
getValueAsFloat
Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing {@link #getCriteria(),sub criteria}.- Returns:
-
getValueAsDate
Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing {@link #getCriteria(),sub criteria}.- Returns:
-
getValueAsBoolean
Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing {@link #getCriteria(),sub criteria}.- Returns:
-
getValueAsStringArray
Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing {@link #getCriteria(),sub criteria}.- Returns:
-
getValueAsIntArray
public int[] getValueAsIntArray()Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing {@link #getCriteria(),sub criteria}.- Returns:
-
asAdvancedCriteria
Returns an AdvancedCriteria derived from this Criteria object.- Overrides:
asAdvancedCriteriain classCriteria- Returns:
-