Select to view content in your preferred language

Using Custom Data Expressions Within a Serial Chart to Sum Integer Fields?

411
0
03-15-2023 05:45 AM
DaveK
by
Occasional Contributor

Hello, 

I'm building a Dashboard containing a serial chart which displays multiple bird species and the counts of males, females, young, and unknown. 

DaveK_1-1678884161491.png

DaveK_3-1678884253578.png

 

I would like to sum the number of bird fields for each row into a new field (totalCount) using a data expression. Can anyone help me put together an expression that will do that? Here's where I ended up with my own expression that doesn't work. 

var portal = Portal('https://www.arcgis.com/');
var fs = FeatureSetByPortalItem(portal, 'HidingthefeatureID',0,
['uplandBird','adultMales','adultFemales','young','unknown'],false);

var totalcount = {
    'fields': [{'name':'sumtotal', 'type':'esriFieldTypeDouble'}],
    'geometryType': '',
    'features':
    [{'attributes':
     {'sumtotal': (fs,'adultMales'+fs,'adultFemales'+fs,'young'+fs,'unknown')
     }}]};

return FeatureSet(Double(totalcount));
 
Any help is appreciated. 
Thanks.
0 Kudos
0 Replies