Constants

The following constants are available for your convenience in writing expressions:

Infinity

Represents a value greater than any other number. -Infinity may also be used as a value smaller than any number.

Example

Calculates the maximum of four field values

var values = [ $feature.field1, $feature.field2, $feature.field3, $feature.field4 ];
var max = -Infinity;

for(var i in values){
  max = IIF(values[i] > max, values[i], max);
}

return max;


PI

The value of a circle's circumference divided by its diameter, approximately 3.14159.

Example

Returns the area of a circle feature

var r = $feature.radius;
PI * r * r;


TextFormatting.BackwardSlash

Inserts a backslash character \ into the text.

Example

Returns '\\serverName\foo\bar'

TextFormatting.BackwardSlash + TextFormatting.BackwardSlash + $feature.FILE_PATH


TextFormatting.DoubleQuote

Inserts a double quote character " into the text.

Example

Returns 'Nicholas "Nick" Anderson'

$feature.NAME + " " + TextFormatting.DoubleQuote + $feature.ALIAS + TextFormatting.DoubleQuote + " " + $feature.SURNAME


TextFormatting.ForwardSlash

Inserts a forward slash character / into the text.

Example

Returns '151/low'

$feature.POP_DENSITY + TextFormatting.ForwardSlash + $feature.CLASS


TextFormatting.NewLine

Inserts a new line, or line break, into the text. Multi-line labels are NOT supported in the ArcGIS API 3.x for JavaScript nor in the ArcGIS Online map viewer.

Example

Returns "T2N R1W"

"T" + $feature.TOWNSHIP + TextFormatting.NewLine + "R" + $feature.RANGE


TextFormatting.SingleQuote

Inserts a single quote character ' into the text.

Example

Returns "Nicholas 'Nick' Anderson"

$feature.NAME + " " + TextFormatting.SingleQuote + $feature.ALIAS + TextFormatting.SingleQuote + " " + $feature.SURNAME


TextFormatting.Tab

Inserts a tab into the text.

Example

Returns "T2N R1W"

"T" + $feature.TOWNSHIP + TextFormatting.Tab + "R" + $feature.RANGE



Feedback on this topic?