Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Arcade

Data Functions

A set of convenient functions for working with and manipulating various types of data values.

Attachments - Console - Count - Dictionary - Distinct - DomainCode - DomainName - Feature - FeatureSet - FeatureSetById - FeatureSetByName - FeatureSetByPortalItem - FeatureSetByRelationshipName - Filter - First - GroupBy - Guid - HasKey - IndexOf - IsNan - NextSequenceValue - Number - OrderBy - Portal - Reverse - Sort - Text - TopTypeOf


Attachments

Attachments( feature, options? ) -> Attachment[]

Since version 1.6

Profiles: Field Calculate

Returns a list of attachments associated with the input feature. Each result includes the name of the attachment, the content type, id, and size in bytes.

Name Type Description
feature Feature Attachments associated with this feature will be fetched from the service.
options Dictionary optional Optional settings for the request. See the table below for available options:

OptionTypeDescription
typesText[]An array of stings representing the file types to fetch. The following are supported values: bmp, ecw, emf, eps, ps, gif, img, jp2, jpc, j2k, jpf, jpg, jpeg, jpe, png, psd, raw, sid, tif, tiff, wmf, wps, avi, mpg, mpe, mpeg, mov, wmv, aif, mid, rmi, mp2, mp3, mp4, pma, mpv2, qt, ra, ram, wav, wma, doc, docx, dot, xls, xlsx, xlt, pdf, ppt, pptx, txt, zip, 7z, gz, gtar, tar, tgz, vrml, gml, json, xml, mdb, geodatabase
minsizeNumberThe minimum file size of the attachment in bytes.
maxsizeNumberThe maximum file size of the attachment in bytes.
Returns: Attachment[]
Example

Returns the number of attachments associated with the feature

// Returns the number of attachments associated with the feature
Count(Attachments($feature))


Console

Console( message [,obj,text, ...objN,textN] ) -> Text

Logs a message in the messages window for debugging purposes. This function can be especially useful for inspecting variable values within a custom function at runtime. Unlike other functions and the return statement, Console() doesn't actually return a value; rather, it logs messages in a separate window for inspection purposes only. The successful use of this function has no computational impact on the evaluation of the expression.

Name Type Description
message [,obj,text, ...objN,textN] * A list of variables, messages, or objects to output in the messages window.
Returns: Text
Example

Prints the value of max for each iteration of the loop within the function

// The messages 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 max = -Infinity;
  for (var i in yourArray) {
    max = IIf(yourArray[i] > max, yourArray[i], max);
    Console('current item is: ' + i + ', but max = ' + max);
  }
  return max;
}
var myArray = [ 10, 0, 84, 30];
findMax(myArray);


Count

Count( values ) -> Number

Returns the number of items in an array or FeatureSet, or the number of characters in a string.

Name Type Description
values Array | Text | FeatureSet An array or string on which to perform the operation. In profiles that support accessing data, this can be a FeatureSet.
Returns: Number
Example

Returns 6

Count([12,21,32,44,58,63])

Returns 13

Count('Graham County')

Returns the number of features in a layer

Count($layer)

Dictionary

This function has 2 signatures:

Dictionary( name1?, value1?, [...nameN, compareN]? ) -> Dictionary

Returns a new dictionary based on the provided arguments. The arguments are name/value pairs. e.g. dictionary('field1',val,'field2',val2,...).

Name Type Description
name1 Text optional The attribute name.
value1 * optional The attribute value to pair to name1.
[...nameN, compareN] * optional Ongoing name/value pairs.
Returns: Dictionary
Example

prints 3

var d = Dictionary('field1', 1, 'field2', 2)
return d.field1 + d.field2

Dictionary( json? ) -> Dictionary

Since version 1.8

Returns a new dictionary from stringified JSON.

Name Type Description
json Text optional The stringified JSON to convert to an Arcade dictionary.
Returns: Dictionary
Example

Creates a dictionary from stringified JSON

var extraInfo = '{"id": 1, "population": 200, "city": "Spencer, ID"}'
var spencerIDdata = Dictionary(extraInfo)
spencerIDdata.population // Returns 200


Distinct

This function has 2 signatures:

Distinct( values ) -> Array

Since version 1.1

Returns a set of distinct, or unique, values for a given array or list of values.

Name Type Description
values Array An array or list of values on which to perform the operation.
Returns: Array
Example
Distinct([1,1,2,1,1,2,2,3,4,5])
// Returns [1,2,3,4,5]

Distinct('high','medium','low',0,'high','high','low')
// Returns ['high','medium','low',0]

Distinct( featureset, fields ) -> FeatureSet

Since version 1.8

Profiles: Attribute Rules | Field Calculate | Popup

Returns a set of distinct, or unique, values from a FeatureSet.

Name Type Description
featureset FeatureSet A FeatureSet from which to return distinct values.
fields Text | Array | Object The field(s) and/or expression(s) from which to determine unique values. This parameter can be an array of field names, an array of expressions, or an object or array of objects that specify output column names where unique values will be stored. If an object is specified, the specification in the following table must be used.

PropertyDescription
nameThe name of the column to store the result of the given expression.
expressionA SQL-92 expression from which to calculate a unique value.
Returns: FeatureSet
Example

Returns a FeatureSet with a 'Status' column. Each row of the feature set contains a unique stats value

Distinct($layer, 'Status')

Returns a FeatureSet with a 'Status' and a 'Type' column. Each row of the feature set contains a unique combination of 'Status' and 'Type' values

Distinct($layer, ['Status', 'Type'])

Returns FeatureSet with a Density column with rows that may contain values of Low, High, or N/A

Distinct($layer, {name:'Density', expression:"CASE WHEN PopDensity < 100 THEN 'Low' WHEN PopDensity >= 100 THEN 'High' ELSE 'N/A' END" })

Returns FeatureSet with a Score and a Type column

Distinct($layer, [
  { name: 'Score', expression: 'POPULATION_DENSITY * 0.65 + Status_Code * 0.35' }
  { name: 'Type', expression: 'Category' }
])


DomainCode

DomainCode( feature, fieldName, value, subtype ) -> Text

Since version 1.7

Returns the code of an associated domain description in a feature.

Name Type Description
feature Feature | FeatureSet The feature with a field that has a domain. In profiles that support accessing data, this can be a FeatureSet.
fieldName Text The name of the field (not the alias of the field) containing the domain.
value Text The value to be converted back into a code. This parameter is required when a FeatureSet is passed to the feature parameter. The returned code comes from the service metadata.
subtype Text The coded number for the subtype if the feature supports subtyping. If not provided, the current feature's subtype (if it has one), will be used.
Returns: Text
Example

prints the domain description for the field referenced.

DomainCode($feature, 'Enabled', 'True')

DomainName

DomainName( feature, fieldName, code, subtype? ) -> Text

Since version 1.7

Returns the descriptive name for a domain code in a feature.

Name Type Description
feature Feature | FeatureSet The feature with a field that has a domain. In profiles that support accessing data, this can be a FeatureSet.
fieldName Text The name of the field (not the alias of the field) containing the domain.
code Text The code associated with the desired descriptive name. If not provided, the field value in the feature will be returned. This parameter is required when a FeatureSet is passed to the feature parameter. The returned code comes from the service metadata.
subtype Text optional The coded number of the subtype if the feature supports subtyping. If not provided, the feature's subtype (if it has one) will be used.
Returns: Text
Example

prints the domain description for the referenced field

DomainName($feature, 'fieldName')

Feature

Feature( geometry, name1, value1, [... nameN, valueN]? ) -> Feature

Creates a new feature. Alternatively, it can be called with object notation: Feature({geometry: {}, attributes: {...}}) or with two parameters: Feature(geometry, attributes);.

Name Type Description
geometry Geometry The geometry of the feature.
name1 Text The first attribute's name.
value1 Text | Date | Number | Boolean The first attribute's value.
[... nameN, valueN] * optional Ongoing name/value pairs for each attribute in the feature.
Returns: Feature
Example
Feature(pointGeometry, 'city_name', 'Spokane', 'population', 210721)
Create a feature from another feature.
var dict = { hello:10 }
var p = point({x:10, y:20, spatialReference:{wkid:102100}})
var ftr1 = Feature(p,dict)
var ftr2 = Feature(ftr1)

Create a feature from a JSON string.
var JSONString = "{'geometry':{'x':10,'y':20,'spatialReference':{'wkid':102100}},'attributes':{'hello':10}}"
var feature = Feature(JSONString)


FeatureSet

FeatureSet( definition ) -> FeatureSet

Since version 1.5

Profiles: Attribute Rules | Popup | Field Calculate

Creates a new FeatureSet from JSON according to the ArcGIS REST spec. See the snippet below for an example of this.

Name Type Description
definition Text The JSON describing a set of features. The JSON must be contained in a text value.
Returns: FeatureSet
Example
Create a FeatureSet from JSON.
// JSON representation of the feature used in the snippet below
// {
//   'fields': [{
//     'alias': 'RANK',
//     'name': 'RANK',
//     'type': 'esriFieldTypeInteger'
//   }, {
//     'alias': 'ELEV_m',
//     'name': 'ELEV_m',
//     'type': 'esriFieldTypeInteger'
//   }],
//   'spatialReference': { 'wkid': 4326 },
//   'geometryType': 'esriGeometryPoint',
//   'features': [{
//     'geometry': {
//       'spatialReference': { 'wkid': 4326 },
//       'x': -151.0063,
//       'y': 63.069
//     },
//     'attributes': {
//       'RANK': 1,
//       'ELEV_m': 6168
//     }
//   }]
// };
// The Dictionary representation of the FeatureSet must be a stringified object
var features = FeatureSet('{"fields":[{"alias":"RANK","name":"RANK","type":"esriFieldTypeInteger"},{"alias":"ELEV_m","name":"ELEV_m","type":"esriFieldTypeInteger"}],"spatialReference":{"wkid":4326},"geometryType":"esriGeometryPoint","features":[{"geometry":{"spatialReference":{"wkid":4326},"x":-151.0063,"y":63.069},"attributes":{"RANK":1,"ELEV_m":6168}}]}')


FeatureSetById

FeatureSetById( map, id, fieldList?, includeGeometry? ) -> FeatureSet

Since version 1.5

Profiles: Attribute Rules | Popup | Field Calculate

Creates a FeatureSet from a Feature Layer based on its layer ID within a map or feature service. Limiting the number of fields in the request and excluding the geometry can improve the performance of the script.

Name Type Description
map FeatureSetCollection The map or feature service containing one or more layers from which to create a FeatureSet. Typically, this value is the $map or $datastore global.
id Text The ID of the layer within the given map. *Please note that this must be a string literal.
fieldList Text[] optional The fields to include in the FeatureSet. By default, all fields are included. To request all fields in the layer, set this value to ['*']. Limiting the number of fields improves the performance of the script.
includeGeometry Boolean optional Indicates whether to include the geometry in the features. By default, this is true. For performance reasons, you should only request the geometry if necessary, such as for use in geometry functions.
Returns: FeatureSet
Example
Returns the number of features in the layer with the id DemoLayerWM_1117 in the given map.
var features = FeatureSetById($map,'DemoLayerWM_1117', ['*'], true);
Count( features );


FeatureSetByName

FeatureSetByName( map, title, fieldList?, includeGeometry? ) -> FeatureSet

Since version 1.5

Profiles: Attribute Rules | Popup | Field Calculate

Creates a FeatureSet from a Feature Layer based on its name within a map or feature service. Keep in mind this name is not necessarily unique. It is therefore more appropriate to create a FeatureSet using FeatureSetById(). Limiting the number of fields in the feature set and excluding the geometry can improve the performance of the script.

Name Type Description
map FeatureSetCollection The map or feature service containing one or more layers from which to create a FeatureSet. Typically, this value is the $map or $datastore global.
title Text The title of the layer within the given map. *Please note that this must be a string literal.
fieldList Text[] optional The fields to include in the FeatureSet. By default, all fields are included. To request all fields in the layer, set this value to ['*']. Limiting the number of fields improves the performance of the script.
includeGeometry Boolean optional Indicates whether to include the geometry in the features. By default, this is true. For performance reasons, you should only request the geometry if necessary, such as for use in geometry functions.
Returns: FeatureSet
Example
Returns the number of features in the layer with the title 'Bike routes' in the given map.
var features = FeatureSetByName($map,'Bike routes', ['*'], true);
Count( features );


FeatureSetByPortalItem

FeatureSetByPortalItem( portal, itemId, layerId, fieldList?, includeGeometry? ) -> FeatureSet

Since version 1.8

Profiles: Field Calculate | Popup

Creates a FeatureSet from a Feature Layer in a portal item from a given Portal. Limiting the number of fields in the feature set and excluding the geometry can improve the performance of the script.

Name Type Description
portal Portal The Portal from which to query features from a given portal item ID.
itemId Text The GUID of the portal item referencing a feature layer or feature service. *Please note that this must be a string literal.
layerId Number The ID of the layer in the feature service.
fieldList Text[] optional The fields to include in the FeatureSet. By default, all fields are included. To request all fields in the layer, set this value to ['*']. Limiting the number of fields improves the performance of the script.
includeGeometry Boolean optional Indicates whether to include the geometry in the features. For performance reasons, you should only request the geometry if necessary, such as for use in geometry functions.
Returns: FeatureSet
Example
Returns the number of features in the layer from a different portal than the feature in the map
var portal = Portal('https://www.arcgis.com');
var features = FeatureSetByPortalItem(portal, '7b1fb95ab77f40bf8aa09c8b59045449', 0, ['Name', 'Count'], false);
Count( features );


FeatureSetByRelationshipName

FeatureSetByRelationshipName( feature, relationshipName, fields?, includeGeometry? ) -> FeatureSet

Since version 1.8

Profiles: Attribute Rules | Field Calculate | Popup

Returns the related records for a given feature as a FeatureSet.

Name Type Description
feature Feature The feature from which to fetch related records.
relationshipName Text The name of the relationship according to the feature service associated with the given feature.
fields Text[] optional The fields to return in the FeatureSet. This list includes fields from both the relationship table and the input Feature.
includeGeometry Boolean optional Indicates whether to return the geometry for the resulting features.
Returns: FeatureSet
Example
var results = FeatureSetByRelationshipName($feature, 'Election_Results', ['*'], false)
Sum(results, 'democrat + republican + other')


Filter

Filter( featureSet, filter ) -> FeatureSet

Since version 1.5

Profiles: Attribute Rules | Popup | Field Calculate

Filters a FeatureSet based on a SQL92 expression.

Name Type Description
featureSet FeatureSet The FeatureSet, or layer, to filter.
filter Text The SQL92 expression used to filter features in the layer. This expression can substitute an Arcade variable using the @ character. See the snippet below for an example.
Returns: FeatureSet
Example
Filter features using a SQL92 expression
// Returns all features with a Population greater than 10,000
var result = Filter($layer, 'POPULATION > 10000');

Filter features using a SQL92 expression with a variable substitute
// Returns all features with a Population greater than the dataset average
var averageValue = Average($layer, 'POPULATION')
var result = Filter($layer, 'POPULATION > @averageValue');


First

First( items ) -> *

Returns the first element in an array or FeatureSet.

Name Type Description
items Array | FeatureSet The array from which to return the first feature. In profiles that support accessing data, this can be a FeatureSet.
Returns: *
Example

prints 'orange'

First(['orange', 'purple', 'gray'])

returns the area of the first feature in the layer.

Area( First($layer) )

GroupBy

GroupBy( featureset, groupByFields, statistics ) -> FeatureSet

Since version 1.8

Profiles: Attribute Rules | Field Calculate | Popup

Returns statistics as a FeatureSet for a set of grouped or distinct values.

Name Type Description
featureset FeatureSet A FeatureSet from which to return statistics for unique values returned from a given set of fields and/or expressions.
groupByFields Text | Text[] | Object[] The field(s) and/or expression(s) from which to group statistics by unique values. This parameter can be a single field name, an array of field names, or an array of objects that specify column names paired with an expression (typically the field name) for the output FeatureSet. If an array of objects is specified, the following specification must be followed for each object.

PropertyDescription
nameThe name of the column to store the result of the given expression.
expressionA SQL-92 expression from which to group statistics. This is typically a field name.
statistics Object | Object[] The summary statistics to calculate for each group. This parameter can be an object or array of objects that specify output statistics to return for each group. The specification in the following table must be used.

PropertyDescription
nameThe name of the column to store the result of the given statistical query in the output FeatureSet.
expressionA SQL-92 expression or field name from which to query statistics.
statisticThe statistic type to query for the given field or expression.

Possible Values: SUM | COUNT | MIN | MAX | AVG | STDEV | VAR
Returns: FeatureSet
Example

Returns the count of each tree type

var treeStats = GroupBy($layer, 'TreeType', { name: 'NumTrees', expression: '1', statistic: 'COUNT' });
// treeStats contains features with columns TreeType and NumTrees
// Each unique tree type will have a count

Returns the count and the average height of each tree type

var treeStats = GroupBy($layer,
  [  // fields/expressions to group statistics by
    { name: 'Type', expression: 'TreeType'},
    { name: 'Status', expression: 'TreeStatus'}
  ], 
  [  // statistics to return for each unique category
    { name: 'Total', expression: '1', statistic: 'COUNT' }, 
    { name: 'AvgHeight', expression: 'Height', statistic: 'AVG' }, 
    { name: 'MaxPercentCoverage', expression: 'CoverageRatio * 100', statistic: 'MAX' }
  ]
);
// treeStats contains features with columns Type, Status, Total, AvgHeight, MaxPercentCoverage
// Each unique tree type (combination of type and status) will have a count, average height, and maximum value of percent coverage


Guid

Guid( format? ) -> Text

Since version 1.3

Returns a random GUID as a string.

Name Type Description
format Text optional An named format for the GUID. The default value is digits-hyphen-braces.

Possible Values: digits / digits-hyphen / digits-hyphen-braces / digits-hyphen-parentheses
Returns: Text
Example

Returns a value similar to {db894515-ed21-4df1-af67-36232256f59a}

Guid()

Returns a value similar to d00cf4dffb184caeb8ed105b2228c247

Guid('digits')

HasKey

HasKey( feature, key ) -> Boolean

Indicates whether a dictionary or feature has the input key.

Name Type Description
feature Dictionary | Feature The dictionary or feature to check for a key or field name.
key Text The key or field name to check.
Returns: Boolean
Example

prints true

var d = Dictionary('Port Hope', 16214,  'Grafton', '<1000', 'Cobourg', 18519);
HasKey(d, 'Cobourg');


IndexOf

IndexOf( inputArray, item ) -> Number

Returns the zero-based index location of the input item in an array. If item does not exist, then -1 is returned.

Name Type Description
inputArray Array The array to search.
item * The item to locate in the array.
Returns: Number
Example

prints 2

var array = [1,2,3,4];
return indexof(array, 3);


IsNan

IsNan( value ) -> Boolean

Since version 1.5

Indicates whether the input value is not a number (NaN). A number is considered NaN in one of the following scenarios:

  • 0/0
  • Infinity / Infinity
  • Infinity * 0
  • Any operation in which NaN is an operand
  • Casting a non-numeric string or undefined to a number

Name Type Description
value * The value to check if it is NaN.
Returns: Boolean
Example
// Returns true
IsNan(Infinity / Infinity)

// Returns false
IsNan('4')


NextSequenceValue

NextSequenceValue( inputSequenceName ) -> Number

Since version 1.4

Profiles: Attribute Rule Calculation

Returns the next sequence value from the database sequence specified. If inputSequenceName does not exist, the expression will error.

Name Type Description
inputSequenceName Text The name of the sequence. This must already be configured in the database.
Returns: Number
Example

Returns a number with the next sequence value

NextSequenceValue('PipeIDSeq')


Number

Number( value, pattern? ) -> Number

Parses the input value to a number.

Name Type Description
value * The value to convert to a number.
pattern Text optional The format pattern string used to parse numbers formatted in a localized context from a string value to a number. The table below describes the characters that may be used in the pattern.

ValueDescription
0Mandatory digits
#Optional digits
%Divide by 100
Returns: Number
Example
Parses a number using a grouping separator appropriate for the local in which the expression is executed

returns 1365

Number('1,365', ',###')
Remove strings from number.

prints 10

Number('abc10def', 'abc##def')
Specify minimum digits past 0 as two and maximum digits past 0 as 4.

prints 10.456

Number('10.456','00.00##')
Specify minimum digits past 0 as two and maximum digits past 0 as 4. The left and right side of the function must match or NaN is returned.

prints NaN

Number('10.4','00.00##')
Indicate the size of the repeated group and the final group size of the input value.

prints 1212456

Number('12,12,456', ',##,###')
If there is a negative subpattern, it serves only to specify the negative prefix and suffix.

prints -1223345

Number('-12,23,345', ',##,###;-,##,###')
Divide by 100. Maximum of three decimal places can be input.

prints 0.9999

Number('99.99%', '#.##%')

OrderBy

OrderBy( featureSet, expression ) -> FeatureSet

Since version 1.5

Profiles: Attribute Rules | Popup | Field Calculate

Orders a FeatureSet by using a SQL92 OrderBy clause.

Name Type Description
featureSet FeatureSet The FeatureSet, or layer, to order.
expression Text The SQL92 expression used to order features in the layer.
Returns: FeatureSet
Example
Order features by population where features with the highest population are listed first
OrderBy($layer, 'POPULATION DESC')

Order features by rank in ascending order
OrderBy($layer, 'Rank ASC')


Portal

Portal( url ) -> Portal

Since version 1.8

Profiles: Field Calculate | Popup

Creates a reference to an ArcGIS Portal.

Name Type Description
url Text The url of the portal.
Returns: Portal
Example

Query features from a portal item in ArcGIS Online

var portal = Portal('https://www.arcgis.com');
var features = FeatureSetByPortalItem(portal, '7b1fb95ab77f40bf8aa09c8b59045449', 0, ['Name', 'Count'], false);

Enterprise Portal

Portal('https://www.example.com/arcgis')

Reverse

Reverse( inputArray ) -> Array

Reverses the contents of the array in place.

Name Type Description
inputArray Array The array to be reversed.
Returns: Array
Example

returns ['grey', 'purple', 'orange']

Reverse(['orange', 'purple', 'grey'])

Sort

Sort( inputArray, comparator? ) -> Array

Sorts an array by ASCII value. If all the items in the array are the same type, an appropriate sort function will be used. If they are different types, the items will be converted to strings. If the array contains objects, and no user defined function is provided, no sort will happen.

Name Type Description
inputArray Array The array to sort.
comparator Text optional The name of a user defined function to be used for the sort.
Returns: Array
Example

returns ['$', 1, 'A', 'a']

Sort([1, 'a', '$', 'A'])
Sort using a user defined function

returns '[{ 'AGE': 24, 'NAME': 'Emma' }, { 'AGE': 25, 'NAME': 'Sam' }, { 'AGE': 27, 'NAME': 'Bob' } ]'

var peopleArray = [{ 'NAME': 'Sam', 'AGE': 25 }, {'NAME': 'Bob', 'AGE': 27 },{ 'NAME': 'Emma', 'AGE': 24 }];
function compareAge(a,b){
  if (a['AGE']<b['AGE'])
    return -1;
  if (a['AGE']>b['AGE'])
    return 1;
  return 0;
}
return Sort(peopleArray, compareAge);


Text

Text( value, format? ) -> Text

Converts its argument into a string and optionally formats it. Returns null if it fails.

Name Type Description
value * A value to be converted to a string (e.g. date, number or other type).
format Text optional Formatting string for dates or numbers. See the list of possible values below.

ValueDescription
0Digit
#Digit, omitting leading/trailing zeros
DDay of the month, not padded (1 - 31).
DDDay of the month, padded (01 - 31).
DDDOrdinal day of the year (1 - 365).
dDay of the week (1 - 7)
dddAbbreviated day of the week (e.g. Mon)
ddddFull day of the week (e.g. Monday).
MMonth number (1 - 12)
MMMonth number, padded (01 - 12).
MMMAbbreviated month name (e.g. Jan).
MMMMFull month name (e.g. January)
mMinutes, not padded (0 - 59).
mmMinutes, padded (00 - 59).
YFull year
YYTwo-digit year
hCivilian hours, not padded (0 - 12)
hhCivilian hours, padded (00 - 12)
HMilitary hours, not padded (0 - 24)
HHMilitary hours, padded (00 - 24)
sSeconds, not padded (0 - 59)
ssSeconds, padded (00 - 59)
Returns: Text
Example
Pad the number to the left of the decimal

prints '0123'

Text(123, '0000')
Restrict the number to the left of the decimal

prints '23'

Text(123, '00')
Group the number by thousands

prints '1,234'

Text(1234, '#,###')
Round the number to two decimal places

prints '12,345,678.12'

Text(12345678.123, '#,###.00')
Format number as currency

prints '$1,234.55'

Text(1234.55, '$#,###.00')
Round the number to two decimal places

prints '1.24'

Text(1.236, '#.00')
Maintain significant digits and group by thousands

prints '1,234.568'

Text(1234.5678, '#,##0.00#')
Format the number and format positive/negative - if there is a negative subpattern, it serves only to specify the negative prefix and suffix

prints 'Basement 2'

Text(-2, 'Floor #;Basement #')

prints 'Floor 2'

Text(2, 'Floor #;Basement #')
Multiply by 100 and format as percentage

prints '30%'

Text(0.3, '#%')
Format date and time

prints the date at the moment. eg 'Tuesday, October 25, 2016 @ 08:43:11'

Text(Now(), 'dddd, MMMM D, yyyy @ h:m:s')

Top

Top( items, numElements ) -> Array / FeatureSet

Since version 1.3

Truncates the input array or FeatureSet and returns the first given number of elements.

Name Type Description
items Array | FeatureSet The array to truncate. In profiles that support accessing data, this can be a FeatureSet.
numElements Number The number of elements to return from the beginning of the array or FeatureSet.
Returns: Array | FeatureSet
Example
returns [ 43,32,19 ]
Top([ 43,32,19,0,3,55 ], 3)
Returns the top 5 features with the highest population
Top( OrderBy($layer, 'POPULATION DESC'), 5 )

TypeOf

TypeOf( value ) -> Text

Returns the type of the input value. Will return one of the following types: Array, Date, Text, Boolean, Number, Dictionary, Feature, Point, Polygon, Polyline, Multipoint, Extent, Function, Unrecognized Type.

Name Type Description
value * The input value, variable, or feature attribute.
Returns: Text
Example

prints 'Boolean'

TypeOf(true)

prints 'Date'

TypeOf(Now())


Feedback on this topic?