Esri / arcade-expressions

ArcGIS Arcade expression templates for all supported profiles in the ArcGIS platform.
Apache License 2.0
272 stars 95 forks source link

GroupBy Expression doesn't return statistics against non-hosted feature layer #68

Open kes1 opened 2 years ago

kes1 commented 2 years ago

Hi arcade team,

Not sure if you are open to issues being reported here but trying out the group by example (ultimately I want to use this for a join), I can't view the results when querying a non-hosted feature layer, that is one in a Postgres enterprise geodatabase. The same expression against a hosted layer works fine.

I looked into the responses from the feature services and they are almost identical, but the hosted service returns a few more properties in the json response;

Is there a limitation on using these arcade data expressions against non-hosted layers? Or is there a workaround/function I can enable on my services to support them?

The expression based on the example;

var portal = Portal('portalurl.org');
var fs = FeatureSetByPortalItem(
    portal,
    'b10d264xxxxxxxxxxxxx',
    1,
    [
        'parentrowid',
        'eo_quantity',
    ],
    false
);

return GroupBy(fs, ['parentrowid'], 
[{name: 'total_devices', expression: 'eo_quantity', statistic: 'SUM' }]); 

The response from the non-hosted feature layer;

{"displayFieldName":"","fieldAliases":{"parentrowid":"parentrowid","t3":"t3","t4":"t4"},"fields":[{"name":"parentrowid","type":"esriFieldTypeString","alias":"parentrowid","length":38},{"name":"t3","type":"esriFieldTypeDouble","alias":"t3"},{"name":"t4","type":"esriFieldTypeInteger","alias":"t4"}],
"features":[
{"attributes":{"parentrowid":"{13F35FA8-0735-4A12-A44D-FA9C7F7337F2}","t3":1,"t4":12046}},
{"attributes":{"parentrowid":"{18DED65D-A9E2-4628-8DCE-F75C565E4337}","t3":5,"t4":11646}
}] }

But this is rendered/returned to the dashboard without the statistics;

image