ArcadeEvaluator QML Type

This object allows you to evaluate an ArcadeExpression under a given Enums.ArcadeProfile. More...

Import Statement: import Esri.ArcGISRuntime 100.14
Since: Esri.ArcGISRuntime 100.14

Properties

Signals

Methods

Detailed Description

This Object allows you to set up, execute, and query information about an Arcade script. For more general information on Arcade and its usages, see the Arcade online documentation.

To construct the ArcadeEvaluator object you need to supply an ArcadeExpression along with an Enums.ArcadeProfile. ArcadeExpression is an object that contains the Arcade script plus some additional metadata while Enums.ArcadeProfile specifies availability of profile variables and limits what functions are available.

The basic workflow is:

From an ArcadeEvaluator object you can query information to determine

  • Which profile variables are accessed by the script.
  • Which attributes are used by a particular profile variable.
  • If the script is considered stable.

Not all scripts use all the profiles variables. profileVariablesUsed returns a list of the names of the profile variables used in the current script. Possible uses include:

  • Informing dependency analysis to determine which scripts need to run when a value of a profile variable changes.
  • Minimizing expensive calculation of unneeded profile variables.

attributesUsingFeatureTable(string, FeatureTable) lets you dig deeper to determine which attributes are required on a specific profile variable. If you are querying a subset of attributes when querying a feature, use this information to ensure the profile variable will have the attributes it requires.

stable property indicates if the given script will return the same value for an identical set of profile variables. For this to be true a script must avoid using unstable built-in functions such as now() or random().

stable can be combined with the knowledge of the used profile variables to construct caches of results. This lets you avoid running scripts when repeated calls with the same profiles variables will not alter the evaluation result.

The following properties are required to instantiate this class. Failing to provide any of them will result in errors. Both of these properties must be provided before the object is loaded.

This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

TypeDefault Property
ArcadeExpressioninitExpression

See also Loadable.

Property Documentation

attributesUsingFeatureTableResults : list<string>

The result returned when the asynchronous attributes(string, FeatureTable) operation completes (read-only).


attributesUsingFeatureTableStatus : Enums.TaskStatus

The current status of the asynchronous attributesUsingFeatureTable(string, FeatureTable) operation (read-only).


attributesUsingGeoElementResults : list<string>

The result returned when the asynchronous attributes(string, GeoElement) operation completes (read-only).


attributesUsingGeoElementStatus : Enums.TaskStatus

The current status of the asynchronous attributesUsingGeoElement(string, GeoElement) operation (read-only).


evaluateResult : ArcadeEvaluationResult

The result returned when the asynchronous evaluate(jsobject) operation completes (read-only).


evaluateStatus : Enums.TaskStatus

The current status of the asynchronous evaluate(jsobject) operation (read-only).


[default] initExpression : ArcadeExpression

The ArcadeExpression used to initialize this object.

This property is required to use this class. It must be provided before the object is loaded.


initProfile : Enums.ArcadeProfile

The Enums.ArcadeProfile used to initialize this object.

This property is required to use this class. It must be provided before the object is loaded.


loadError : Error

Returns the load error (read-only).

Note: Load errors are also reported on the error property and emit the errorChanged signal.

See also Loadable.


loadStatus : Enums.LoadStatus

Returns the load status (read-only).

See also Loadable and Enums.LoadStatus.


profileVariablesUsed : list<string>

Returns a list of the strings containing the names of all profile variables used in the script (read-only).

A collection of names of the profile variables used in the script. Each profile name should have a dictionary of profile values passed to the evaluate function.


stable : bool

Returns whether a script is considered stable (read-only).

A script is considered stable if the script will return the same result given the same inputs. There are certain functions listed below that will return different values on each evaluation. Using these functions means the script is not considered stable.

Arcade functions that stop a script from being considered stable:

  • Now
  • Today
  • TimeStamp
  • Tandom
  • Guid
  • NextSequence

Signal Documentation

attributesUsingFeatureTableStatusChanged()

Emitted when the attributesUsingFeatureTableStatus property changes.

Note: The corresponding handler is onAttributesUsingFeatureTableStatusChanged.


attributesUsingGeoElementStatusChanged()

Emitted when the attributesUsingGeoElementStatus property changes.

Note: The corresponding handler is onAttributesUsingGeoElementStatusChanged.


evaluateStatusChanged()

Emitted when the evaluateStatus property changes.

Note: The corresponding handler is onEvaluateStatusChanged.


initExpressionChanged()

Emitted when the initExpression property changes.

Note: The corresponding handler is onInitExpressionChanged.


initProfileChanged()

Emitted when the initProfile property changes.

Note: The corresponding handler is onInitProfileChanged.


loadErrorChanged()

Emitted when the loadError property of this RouteTask changes.

Note: Load errors are also reported on the error property and emit the errorChanged signal.

Note: The corresponding handler is onLoadErrorChanged.

See also Loadable and Object.


loadStatusChanged()

Emitted when the loadStatus property of this RouteTask changes.

Note: The corresponding handler is onLoadStatusChanged.

See also Loadable.


profileVariablesUsedChanged()

Emitted when the profileVariablesUsed property changes.

Note: The corresponding handler is onProfileVariablesUsedChanged.


stableChanged()

Emitted when the stable property changes.

Note: The corresponding handler is onStableChanged.


Method Documentation

string attributesUsingFeatureTable(string variableName, FeatureTable attributeNameSource)

For a given profile variable, asynchronously gets a list of attributes used in the script.

  • variableName - The name of the profile variable whose used attributes are required.
  • attributeNameSource - A FeatureTable from which we can get a list of all attributes names for the profile variable of interest.

To fully support the wildcard expansion in the expects statement, calculation of used attributes on a profile variable requires an object that can supply a full set of attribute names.

Returns a string representing the task ID of the asynchronous task.


string attributesUsingGeoElement(string variableName, GeoElement attributeNameSource)

For a given profile variable, asynchronously gets a list of attributes used in the script.

  • variableName - The name of the profile variable whose used attributes are required.
  • attributeNameSource - A GeoElement from which we can get a list of all attributes names for the profile variable of interest.

To fully support the wildcard expansion in the expects statement, calculation of used attributes on a profile variable requires an object that can supply a full set of attribute names.

Returns a string representing the task ID of the asynchronous task.


void cancelLoad()

See also Loadable.


bool cancelTask(string taskId)

Cancel the task with the ID taskId.

Returns false if the task cannot be canceled or there is no task with the specified id taskId.

See also Cancelable.


string evaluate(jsobject profileVariables)

Evaluate the script using the supplied profileVariables.

  • profileVariables - The profile variables for the script as key/value pairs. Required for evaluation.

Each entry of the profileVariables dictionary is placed into the interpreter as a value accessible throughout the script. The name and type of these should comply with the profile the Arcade evaluator has been constructed with. Values are not persisted across evaluations, meaning all required profile variables must be supplied with each evaluation.

Each value of a key/value pair in the dictionary is converted to a type understood by the interpreter.

Values in the dictionary can be any of the following types

The following list describes how ArcGIS Runtime types are converted to Arcade types.

Returns a string representing the task ID of the asynchronous task.


void load()

See also Loadable.


void retryLoad()

See also Loadable.


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.