Select to view content in your preferred language

Arcade in Dashboards, from 0 to 'null'

549
3
04-05-2024 07:58 AM
EmanueleCampagnari
Esri Contributor

Greetings to all, I’m new to Arcade and I have a serial chart in a Dashboard, based on an Arcade expression. To correctly display the data obtained through Arcade, I need some of these calculated fields to contain “null”, instead of “0”, as they did in the original table that was used to build the feature set. The feature set consists of two subsequent “groupby” of fields calculated by multiplying (A1), then dividing (A2).

I’d like to use an expression that could convert the “0”s contained in such specific field(s), all at once.

a1.png a2.png

with A2 = group by([....],({...'A1/m' sum})

I ask if there’s a feasible way to work this out. 'Replace', 'Decode', 'If', 'When' functions seem to have little effect on my trials on the entire feature set.

Thank you in advance

0 Kudos
3 Replies
clt_cabq
Frequent Contributor

do all 0 values need to be null? I think you can select the ones you want then recalculate so a2 = None - that is a special key word that replaces a value with null. 

jcarlson
MVP Esteemed Contributor

Can you place a filter in the chart's settings to exclude rows with 0s in those fields?

- Josh Carlson
Kendall County GIS
EmanueleCampagnari
Esri Contributor

Thank you for your contributions, the issue was solved by creating a new table. The problematic fields have been  calculated by decoding the original values, as it follows. It worked fine.

 

var joinedDict = {

'fields': [

...],

'geometryType': '',

  'features':[]

}

 

var i = 0;

 

for (var f in gr){    

    joinedDict.features[i]= {

    attributes:{  

...

'A':decode(f[A2] ,0,null,f[A2]),

    }

    }

    i++

}

return featureset(text(joinedDict))

0 Kudos