reading editor tracking fields with Arcade

238
2
11-28-2023 01:07 PM
MaraKaminowitz
Occasional Contributor

I am trying to create a dashboard that combines data from several layers in Arcade. I have access to the data through an internal Portal item or REST URL. I want to return values from the GIS editor tracking fields (created_user, last_edited_date, etc.).

After several failed attempts with an Arcade script, I realized that the problem is not the script itself, but that Arcade is not returning data from the editor tracking fields at all. The script can read and return data in the other fields. The data in the editor tracking fields is visible if I view the attribute table in a web map.

Does anyone have an idea of a solution? I don't have access to the source data so I can't populate a column with duplicate data.

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

There should be no problem reading those fields via Arcade, it's something we use in a number of expressions. Can you share what you've written so far?

- Josh Carlson
Kendall County GIS
0 Kudos
MaraKaminowitz
Occasional Contributor

This is based on the code here. To simplify troubleshooting I have only included one web service, but my intention is to combine data from several layers into this expression.

var portal = Portal('https://gis.MyOrg.org/portal')

// Zoning
var zoning = FeatureSetByPortalItem(
portal,
'###item###',
0,
['NEW_ZONE'],
false
)

var lyrs = [zoning]

var features = []
var feat;

for (var lyr in lyrs){
for (var l in lyrs[lyr]){
feat = {
attributes: {
NEW_ZONE: l.NEW_ZONE
}
}

Push(features, feat)
}
}

var fs_dict = {
fields: [
{name: 'NEW_ZONE', type: 'esriFieldTypeString'}
],
geometryType: '',
features: features
}

return FeatureSet(Text(fs_dict))

 The above script will return the requested zoning field. The data from this expression can be used in a chart in the dashboard. However if I change the field name to one of the tracking fields, it goes blank no matter what the data type.  In addition, if I test the code on "return zoning" for all fields, I can see all the field values except the tracking fields.

0 Kudos