I have just started using arcade, I'm attempting to create a dictionary so I can reclassify the ages into groups (from a hosted feature layer), but my dictionary comes up empty. Below is the arcade code:
var ages = FeatureSetByPortalItem(
Portal('//myportallink'),
'//itemid',
0,
['*'],
false);
// return ages
// create empty dictionary
var out_dict = {
fields: [
{name: 'age', alias: 'age', type: 'esriFieldTypeInteger'},
{name: 'age_group', alias: 'age_group', type: 'esriFieldTypeString'},
],
geometryType: '',
features: []
}
// //loop through and populate the dictionary
var index = 0
for(var p in ages) {
out_dict.features[index++] = {
attirbutes : {
age: number(p['app_age_id']),
age_group:when(
0 >= p['app_age_id'] <= 14, '0-14',
15 >= p['app_age_id'] <= 24, '15-24',
25 >= p['app_age_id'] <= 54, '25-54',
55 >= p['app_age_id'] <= 64, '55-64',
p['app_age_id'] >= 65, '65+',
'')
}
}
};
return FeatureSet(text(out_dict))
When I test this, the result looks like this:
Solved! Go to Solution.
You have a typo on line 25 "attirbutes" instead of "attributes"
Thank you. I did not notice. fixed!!