Functions for debugging expressions.
Console Console([value1, ..., valueN]?) -> NullFunction bundle: Core
Logs a message to a console for debugging purposes. This function can be especially useful for debugging expressions. Unlike most functions, Console()
does not return a value; rather, it logs messages in a separate window for data inspection purposes only. The successful use of this function has no computational impact on the evaluation of the expression. The location of the console depends on the profile or context where the expression is authored. If authoring an expression in ArcGIS Online, logged messages are accessed in the "Console" tab of the results window in the Arcade Editor. Expressions executed in web clients will log console messages to the browser console.
Parameter
Return value: Null
Example
Logs the value of max
for each iteration of the loop within the function
Use dark colors for code blocks Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// The console window will log the following:
// 'current item is: 10, but max = 10'
// 'current item is: 0, but max = 10'
// 'current item is: 84, but max = 84'
// 'current item is: 30, but max = 84'
// The expression evaluates to 84
function findMax(yourArray) {
var maxValue = -Infinity;
for (var i in yourArray) {
maxValue = IIf(yourArray[i] > maxValue, yourArray[i], maxValue);
Console('current item is: ' + i + ', but maxValue = ' + maxValue);
}
return maxValue;
}
var myArray = [ 10, 0, 84, 30 ];
findMax(myArray);
GetEnvironment GetEnvironment() -> Dictionary
Function bundle: Core
Provides information about the context and environment where the Arcade expression is executed.
Return value: Dictionary
Returns a dictionary containing the properties below. The properties returned may vary based on where you are running the Arcade expression, so it is recommended to use the HasValue
function to ensure the desired environment property exists.
version: Text - The Arcade version. See the Arcade version matrix for more information about versioning.
engine: Text - The engine executing the Arcade expression. Possible values: web
, native
, jvm
engineVersion: Text - The version of the engine executing the Arcade expression. See the Arcade version matrix for more information about versioning.
application: Text - The application in which the Arcade expression is run. It is up to application developers to set this value. Therefore, this property may be empty depending on the app in which the expression executes.
locale: Text - The locale of the client or system.
spatialReference: Dictionary - The spatial reference of the Arcade context.
timeZone: Text - Since 1.24 The time zone of the expression's execution context. This is used when constructing and displaying Date values if a time zone is not otherwise specified.
userTimeZone: Text - Since 1.30 The time zone of the device or browser executing the Arcade expression.
Additional resources
Example
Gets the environment of the client or system
Use dark colors for code blocks Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var env = GetEnvironment()
// equals the following when executed in a JavaScript Maps SDK application
// {
// "version":"1.30",
// "engine":"web",
// "engineVersion":"4.32",
// "application":"",
// "locale":"en",
// "spatialReference": { "wkid": 102100 }
// "timeZone":"America/Los_Angeles",
// "userTimeZone":"America/Los_Angeles"
// }
var locale = IIF(HasValue(env, "locale"), env.locale, "");
// returns the locale if it exists, otherwise returns an empty text value
return locale;
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4