Property Overview
Name | Type | Summary | Object |
---|---|---|---|
String[] | An array of the field names used in the where clause. more details | WhereClause | |
Boolean | Returns | WhereClause | |
SQLNode | A parse tree is a data structure for representing a parsed sql statement. more details | WhereClause |
Property Details
-
An array of the field names used in the where clause. It can be used to get the appropriate fields when querying layers.
Example// parse layer's definition expression into where clause object sql.parseWhereClause(layer.definitionExpression, layer.fieldsIndex) .then(function(clause){ layer.queryFeatures({ where: "1=1", // where clause object returns layer fields // use these fields to query features from the layer outFields: clause.fieldsNames }).then(function(results) { // process query results }); });
-
isStandardized Booleanreadonly
-
Returns
true
if the parsed where clause meets the requirements of standardized sql.
-
parseTree SQLNodeSince: ArcGIS Maps SDK for JavaScript 4.24
-
A parse tree is a data structure for representing a parsed sql statement. Parsing a statement requires the grammar of the language that the statement was written.
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Object | Executes the where clause against a feature to generate a value. more details | WhereClause | |
Boolean | Tests the attributes of a feature against the | WhereClause |
Method Details
-
calculateValue(feature){Object}
-
Executes the where clause against a feature to generate a value. It is used when the
WhereClause
is being used as a simple expression. For example, you can use the expression to gather values for statistics.Parameterfeature ObjectThe feature to check against the where clause.
ReturnsType Description Object Returns a value after check feature against the provided where clause. Returns null
if the provided value is unknown.Example// calculate the grand total sales price of all features featureLayer.queryFeatures().then(function(results){ let total; const expression = "totalSales * totalPrice"; sql.parseWhereClause(expression, layer.fieldsIndex) .then(function(whereClause){ // check if the where clause meets requirements of standardized sql if (whereClause.isStandardized){ features.forEach(function(feature){ total += whereClause.calculateValue(feature) }); console.log(total); // prints the total sales price of all features } }); });
-
testFeature(feature){Boolean}
-
Tests the attributes of a feature against the
whereClause
, and returnstrue
if the test passes,false
otherwise.Parameterfeature ObjectThe feature to test against the
whereClause
.ReturnsType Description Boolean Returns true
if the test passes,false
otherwise.Examplesql.parseWhereClause("POPULATION > 100000", layer.fieldsIndex) .then(function(clause){ let testResult = clause.testFeature(new Graphic({ attributes: { POPULATION: 300000 } }); console.log(testResult); // prints true });
Type Definitions
-
BinaryNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A binary expression node. It is an operator that defines the way two expressions are combined to yield a single result. It can be an arithmetic operator, the assignment operator (=), a comparison operator (>=), a logical operator (AND), or a string concatenation operator (+).
- Properties
-
type String
The value is always "binary-expression".
operator StringDefines the way two expressions are combined to yield a single result.
Possible Values:"AND"|"OR"|"IS"|"ISNOT"|"IN"|"NOT IN"|"BETWEEN"|"NOTBETWEEN"|"LIKE"|"NOT LIKE"|"<>"|"<"|">"|">="|"<="|"="|"*"|"-"|"+"|"/"
left SQLNodeSQL node to the left of the binary node.
right SQLNodeSQL node to the right of the binary node.
escape StringEscape string.
-
BoolNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains a boolean expression. Used for expressing a condition or criterion which can be either true or false.
-
ColumnNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains column name of a layer or table.
-
CurrentTimeNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains
CURRENT_TIME
orCURRENT_DATE
functions.
-
DateNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains date.
-
FunctionNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A nodes that contains SQL function.
-
IntervalNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
Interval node indicates that the character literal is an interval. An interval is defined as the difference between two dates and times.
- Properties
-
type String
The value is always "interval".
value StringNodeInterval node value.
op StringInterval node sign.
Possible Values:"+"|"-"|""
qualifier IntervalQualifierNode|IntervalPeriodNodeThe interval qualifier can either be a single datetime field or be composed of two datetime fields, in the form:
TO .
-
IntervalPeriodNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
Interval period node.
-
IntervalQualifierNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
Node that contains interval qualifier. The interval qualifier can either be a single datetime field or be composed of two datetime fields, in the form:
<leading field> TO <trailing field>
.- Properties
-
type String
The value is always "interval-qualifier".
period StringInterval node periods.
Possible Values:"day"|"month"|"hour"|"second"|"year"|"minute"
precision NumberPrecision for an interval data type includes interval leading precision, interval precision, and seconds precision.
secondary StringSeconds precision.
The value is always "number".
-
ListNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains a list.
-
NullNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains
NULL
value.
-
NumberNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains number.
-
SearchedCaseNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
Node that contains case expression.
-
SimpleCaseNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
Simple case expression node. Case expressions provide a decoding capability that allows one expression to be transformed into another. Case expressions can appear anywhere that other forms of expressions can be used.
-
Since: ArcGIS Maps SDK for JavaScript 4.24
-
SQL parse tree is composed of SqlNodes. It may be an operator, literal, function, list, and so forth.
-
StringNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains string.
-
TimeStampNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains date.
-
UnaryNode ObjectSince: ArcGIS Maps SDK for JavaScript 4.24
-
A node that contains unary operator. Unary operators can be applied only to expressions that evaluate to any one of the data types of the numeric data type category.