Select to view content in your preferred language

New Map Viewer Arcade symbology expression - how to make it work if missing data?

396
4
07-23-2024 02:07 PM
maximeglobus
New Contributor

Good Afternoon,

I have an arcade expression in Map Viewer that looks at a service with a field that updates near real time:

var activity_label2 = When($feature.MINUTES <= 15, '15 min', $feature.MINUTES >= 16 && $feature.MINUTES <= 60, '60 min', "Inactive");

return activity_label2

 

It essentially sets up the symbology into three categories depending on the field value. It is fine if the dataset has enough data to "fill the buckets". It allows me to customize the symbology at that point. However, if the dataset doesn't meet all 3 category criteria, then I am unable to customize the missing categories. This makes it hard to give my users a web map that has complete symbology that will appear once that data comes in. Any ideas how to get around this?

0 Kudos
4 Replies
ZachBodenner
MVP Regular Contributor

I have one suggestion that I've used: before you commit the arcade expression, fake some data that would allow all three categories to exist. Then the expression will find all three, you can save it, then delete the dummy data. Inelegant, but it works.

Also, I had this exact conversation with Allison Rost from ESRI after her presentation at the conference last week and she was going to send me a piece of code that she says helps get around this issue. I'll post it here when I get it.

0 Kudos
maximeglobus
New Contributor

Thank you for the reply. That is great news about the code, thank you being open to share it. I will also keep your solution in my back pocket if I need to fall back onto it.

0 Kudos
KenBuja
MVP Esteemed Contributor

I've also gone the route of altering my data to get the correct symbology before reverting it back to its original state. I'll look forward to that code you provide!

0 Kudos
jelisjack
New Contributor

To handle missing data in the new Map Viewer Arcade symbology expression, you can use conditional statements to provide default values or alternative expressions.

0 Kudos