Select to view content in your preferred language

Arcade GroupBy Function Error: Aggregation field not found. Verify test data.

265
6
Jump to solution
3 weeks ago
Labels (1)
ZacStanleyNPS
New Contributor II

Hello,

I'm hoping what I have is simple issue someone can see easier than me. I'm simply trying to aggregate trail names and sum their segment lengths to display in a dashboard list:

 

var portal = Portal('https://www.arcgis.com/'); 
var fs = FeatureSetByPortalItem(Portal,
  '7b1fb95ab77f40bf8aa09c8b59045449',
  0,
  [ 
    'TRLNAME',
    'LengthMiles'
  ], 
    False //don’t include geometry 
); 
return GroupBy(fs, 'TRLNAME', { name: 'LengthMilesSum', expression: 'LengthMiles', statistic: 'SUM' });

 

The expression as is returns the error: Test execution error: Aggregation field not found. Verify test data.

I've tested enough to know that the error is in the group by function. Would love any help / tips.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

There it is! You can see it in the URL:

sublayer=10

Change that to a 10 and it works!

jcarlson_0-1716564742576.png

 

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
6 Replies
jcarlson
MVP Esteemed Contributor

When I look for that AGOL item, it's China prefecture demographics. Definitely no LengthMiles attribute on it.

https://www.arcgis.com/home/item.html?id=7b1fb95ab77f40bf8aa09c8b59045449&view=list&sortOrder=desc&s...

- Josh Carlson
Kendall County GIS
0 Kudos
ZacStanleyNPS
New Contributor II

Well that's embarrassing. Correct Item ID now returns: Test execution error: Unknown Error. Verify test data.

 

var portal = Portal('https://www.arcgis.com/'); 
var fs = FeatureSetByPortalItem(Portal,
  '6a4eb769a1974476a3794a31054ddc63',
  0,
  [ 
    'TRLNAME',
    'LengthMiles'
  ], 
    False //don’t include geometry 
); 
return GroupBy(fs, 'TRLNAME', { name: 'LengthMilesSum', expression: 'LengthMiles', statistic: 'SUM' });
0 Kudos
jcarlson
MVP Esteemed Contributor

I don't have access to that particular item, but I see you're referencing Portal (with a capital p) after assigning the variable portal with a lower-case p. Can you change line 2 to use lower case and see what happens?

- Josh Carlson
Kendall County GIS
0 Kudos
ZacStanleyNPS
New Contributor II

Just caught that error too - I shared the item publicly if that helps. Thanks!

0 Kudos
jcarlson
MVP Esteemed Contributor

There it is! You can see it in the URL:

sublayer=10

Change that to a 10 and it works!

jcarlson_0-1716564742576.png

 

- Josh Carlson
Kendall County GIS
0 Kudos
ZacStanleyNPS
New Contributor II

Right! It's a feature set! TY!

0 Kudos