I have an Arcade Expression to not display any fields that have attributes that are null in the pop-up in the New Map Viewer. When I test it, it shows the dictionary correctly. I then configure the pop-up to use the expression in a Text element (I've also tried it as an Arcade element), and it will only display 3 attributes (GlobalID, OBJECTID, and WBS_Number). If I turn the pop-ups off and then back on again, it'll show all of the attributes without any nulls like it's supposed to, but if I click on a feature, it displays only 3 fields. I've tried everything I can think of, so any help or insight is appreciated.
Arcade Expression with test:
Pop-up Configuration:
Simple Text Element configuration with just the expression:
Correct Pop-up when first opened or after turning pop-ups off and on:
Incorrect pop-up after clicking on features:
You'd need to post all your code if you can, but at a glance your output shouldn't be a dictionary I don't think. What is your return statement?
Sorry, I thought I had the full code in the image, but Here is the code:
I have found that removing the Fields list pop-up element is an issue in the new Map Viewer. Or having only a few fields selected. When you click on a feature, the map checks specifically for the Fields list element to get the list of fields it should send to the feature service for querying. So even if you have them defined in other pop-up elements, they simply won't exist in the query data that is returned from the service.
Luckily, there is a very simple solution. Have a look at the Arcade Expects Function. You can specify the list of fields you want to use for calculating your pop-up element expression. Or, to just return all fields available for processing, add this code to the top of your pop-up expression:
Expects($feature, '*')