Hello -
I'm trying to list averages from featureset variables and display them in a list. My script runs in the ArcCade or "Data Expression" playground but when I try to use it for an element on my dashboard it shows a message "unable to execute script". What am I doing wrong?
var p = 'https://xyz.maps.arcgis.com/';
var itemId = '<layer id goes here>';
var fs = FeatureSetByPortalItem(Portal(p), itemId, 0, ['judgename','totalscore_stu1','totalscore_stu2','totalscore_stu3','totalscore_stu4','totalscore_stu5','totalscore_stu6'], false);
var scoreStu1 = Average(fs, 'totalscore_stu1');
var scoreStu2 = Average(fs, 'totalscore_stu2');
var scoreStu3 = Average(fs, 'totalscore_stu3');
var scoreStu4 = Average(fs, 'totalscore_stu4');
var scoreStu5 = Average(fs, 'totalscore_stu5');
var scoreStu6 = Average(fs, 'totalscore_stu6');
var result = [
{ "Name": "scoreStu1", "Score": scoreStu1 },
{ "Name": "scoreStu2", "Score": scoreStu2 },
{ "Name": "scoreStu3", "Score": scoreStu3 },
{ "Name": "scoreStu4", "Score": scoreStu4 },
{ "Name": "scoreStu5", "Score": scoreStu5 },
{ "Name": "scoreStu6", "Score": scoreStu6 }
];
return result;
thanks in advance for any guidance!