Class Criterion
This class is not meant to be created and used, it is actually documentation of settings allowed in a DataSource descriptor (.ds.xml file), for use with Smart GWT Pro Edition and above. See com.smartgwt.client.docs.serverds for how to use this documentation.
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".
-
Field Summary
FieldsModifier and TypeFieldDescriptionFor 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.End value of a criterion with an operator of type"valueRange".Name of the field in eachRecordthat this criterion applies to.A subquery to use instead of afieldName.A constant value to use as the left-hand side of the comparison, instead of using a field value from the record.Operator this criterion applies.Start value of a criterion with an operator of type"valueRange".Value to be used in the application of this criterion.A subquery to use instead of avalue. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
operator
Operator this criterion applies.Default value is null
- See Also:
-
fieldName
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.Default value is null
- See Also:
-
valueQuery
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 ignoredvalueQueryis supported for client-side filtering ofclientOnlyDataSources,MockDataSources, and cached DataSources. See the "Client-Side Subquery Support" section in thesubquery overviewfor details.Default value is null
- See Also:
-
fieldQuery
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 detailsfieldQueryis supported for client-side filtering ofclientOnlyDataSources,MockDataSources, and cached DataSources. See the "Client-Side Subquery Support" section in thesubquery overviewfor details.Default value is null
- See Also:
-
fieldStaticValue
A constant value to use as the left-hand side of the comparison, instead of using a field value from the record. When set, this value is used in place of the field value that would normally be derived fromfieldNameorfieldQuery.This is useful when comparing a known constant against the result of a
valueQuery. For example, to check whether a particular product code appears in the set of products ordered by a customer:{ fieldStaticValue: "PROD-001", operator: "inSet", valueQuery: { dataSource: "OrderLine", queryOutput: "productCode" } }If bothfieldStaticValueandfieldNameare specified,fieldStaticValueis used instead. If bothfieldStaticValueandfieldQueryare specified,fieldStaticValueis used instead.Default value is null
- See Also:
-
end
End value of a criterion with an operator of type"valueRange".Default value is null
- See Also:
-
start
Start value of a criterion with an operator of type"valueRange".Default value is null
- See Also:
-
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.Default value is null
- See Also:
-
value
Value to be used in the application of this criterion.Value may be required or not required, or may be an Array, according to the
OperatorValueTypeof the operator.Default value is null
- See Also:
-
-
Constructor Details
-
Criterion
public Criterion()
-