Class ArcadeEvaluator
Allows you to evaluate an ArcadeExpression under a given ArcadeProfile.
Inheritance
Implements
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:
- Construct 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
Target | Versions |
---|---|
.NET Standard 2.0 | 100.14 - 200.6 |
.NET | 100.14 - 200.6 |
.NET Windows | 100.14 - 200.6 |
.NET Android | 200.0 - 200.6 |
.NET iOS | 200.0 - 200.6 |
.NET Framework | 100.14 - 200.6 |
Xamarin.Android | 100.14 - 100.15 |
Xamarin.iOS | 100.14 - 100.15 |
UWP | 100.14 - 200.6 |