Hi there,
I have what I thought to be a simple arcade expression that I'm trying to use for a dashboard indicator. Currently I'm working with a table where ages are a string variable and some records have 'NN" or 'BB' to refer to their stage in infancy. I'm looking to recalculate those records to be 0 and then to convert all the ages to integers so I can find the average.
I've been playing with this script all day and I think I'm running into syntax issues with recalling my feature service. Either that or I'm just not understanding the When function. I would really appreciate any suggestions or help!
var port = "https://--------------.arcgis.com"
var itemID = "---------------------------------"
var layerID = 3
var fields = ['AGE']
var geo = False
// Set up the FeatureSet with which to call:
var FS = FeatureSetByPortalItem(Portal(port), itemID, layerID, fields, geo)
// return the set of features to use within indicator:
When($FS.AGE ='BB', '0', $FS.AGE = 'NN', '0', defaultValue);
var newagesdictionary = {
'fields': [
{ 'name': 'age_recalc', 'type': 'esriFieldTypeInteger'}
],
'geometryType':'',
'features':
[{'attributes':
{'newage': Number($FS.AGE)}
}]}
var recalcagedict = FeatureSet(Text(newagesdictionary));
return recalcagedict
I keep getting 'Invalid Parameter as an error message but I'm not sure where it's really referring to.
Thank you so much!