Show / Hide Table of Contents

Class ArcadeEvaluator

Allows you to evaluate an ArcadeExpression under a given ArcadeProfile.

Inheritance
System.Object
ArcadeEvaluator
Implements
ILoadable
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Esri.ArcGISRuntime.Arcade
Assembly: Esri.ArcGISRuntime.dll
Syntax
public sealed class ArcadeEvaluator : ILoadable
Remarks

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

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

The basic workflow is:

  • Create an ArcadeEvaluator object using ArcadeExpression and ArcadeProfile.
  • Query information about a script.
  • Insert the required profile values into a dictionary.
  • Call EvaluateAsync(IEnumerable<KeyValuePair<String, Object>>).
  • Use the returned ArcadeEvaluationResult.

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 an array 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.

GetAttributesAsync(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.

IsStable 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 builtin functions such as now() or random().

IsStable 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.

Constructors

Name Description
ArcadeEvaluator(ArcadeExpression, ArcadeProfile)

Initializes a new instance of the ArcadeEvaluator class with the specified expression and profile.

Properties

Name Description
IsStable

Gets a value indicating whether the script is considered stable.

LoadError

Gets the System.Exception associated with the last load error.

LoadStatus

Gets the load status.

Profile

Gets the Arcade profile under which the script should evaluate.

ProfileVariablesUsed

Gets a collection containing the names of all profile variables used in the script.

Methods

Name Description
CancelLoad()

Cancel loading metadata for the object.

CreateAsync(ArcadeExpression, ArcadeProfile)

Creates a new instance of the ArcadeEvaluator class with the specified Arcade expression and execution context.

EvaluateAsync(IEnumerable<KeyValuePair<String, Object>>)

Evaluates the script using the supplied profile variables.

GetAttributesAsync(String, FeatureTable)

Returns a collection of attributes used in the script for a given profile variable.

GetAttributesAsync(String, GeoElement)

Returns a collection of attributes used in the script for a given profile variable.

LoadAsync()

Load the metadata for the object asynchronously.

RetryLoadAsync()

Loads or retries loading metadata for the object asynchronously.

Events

Name Description
Loaded

Occurs when the Arcade evaluator is loaded.

LoadStatusChanged

Occurs when the LoadStatus property is changed.

Applies to

TargetVersions
.NET Standard 2.0100.14 - 200.8
.NET100.14 - 200.8
.NET Windows100.14 - 200.8
.NET Android200.0 - 200.8
.NET iOS200.0 - 200.8
.NET Framework100.14 - 200.8
Xamarin.Android100.14 - 100.15
Xamarin.iOS100.14 - 100.15
UWP100.14 - 200.8
In This Article
Back to top Copyright © 2022 Esri.