A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.arcgis.com/arcade/function-reference/debugging_functions/ below:

Debugging functions | ArcGIS Arcade

Functions for debugging expressions.

Console Console([value1, ..., valueN]?) -> Null

Since version 1.0

Function 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

Since version 1.23

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.

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