Select to view content in your preferred language

Dynamic text but nothing appears if there is no data

296
8
4 weeks ago
JBH
by
Regular Contributor

I have a string of 6 Near Me widgets that search different distances and run when a user selects a parcel. I would like to provide a summary of the features and the counts that are selected, for example:

Wetlands (1)

Waterbody (2)

Species at Risk (1)

The Near Me widgets analyze around 20 layers total. I do not want the layer name to show in my summary if no features were picked up - i.e. I don't want it to say Railway (0), I just want Railway to not show at all.

I know I can use dynamic text and put a space/empty character in the Expression name but that is still going to appear in my summary, and just make the spacing all weird.

Does anyone know if there is a way to accomplish this?

Thanks!

0 Kudos
8 Replies
AzizaParveen1
Esri Contributor

Hi @JBH, could you please share a screenshot of the expression you are using in the configuration and how it looks at the runtime?

0 Kudos
JBH
by
Regular Contributor

Hi Aziza,

My text would look like this:

"Waterbody ("+COUNT({OBJECTID})+")" with just a space in the Expression name:

JBH_0-1750707009730.png

The output looks like this:

JBH_1-1750707464413.png

I thought I had gotten it to show up as just a space if nothing was within the proximity search but I guess I didn't, or I can't remember how I did...

But basically the output that I am looking for is the above except for where it says Species at Risk (0), I would like it to say nothing at all, because nothing was found. The list would instead look like:

Waterbody (1)
Aggregate Sand & Gravel (2)

 

 

0 Kudos
AzizaParveen1
Esri Contributor

@JBH ,

I have another question, are you showing the summary in Near Me widget? Near Me should not show the layer if there is no intersecting features. For example in this app, I have summary configured in Near Me widget for Wilderness layer, when it intersects with the layer, it shows the summary (Screenshot 1), if the search area does not intersect, the layer name does not show up (Screenshot 2)

AzizaParveen1_0-1750871396232.pngAzizaParveen1_1-1750871411235.png

If you are using Text widget to show your summary you can use arcade expression as Ke suggested, Arcade support will be available in Text widget later tonight after ArcGIS Online June update. 

0 Kudos
JBH
by
Regular Contributor

I am, yes. The problem is that we are migrating from another solution and our user's are used to having a more condensed summary. Because I am stringing together a few Near Me widgets and the output is larger (with the rectangles around the layer name, etc.), the users are having to scroll and take multiple screenshots, which they don't like.

Super excited for Arcade!! Thanks for your help!

0 Kudos
Ke_Xu
by Esri Regular Contributor
Esri Regular Contributor

Hi @JBH,

I think the Arcade script can be used to solve this. Arcade will be available in ArcGIS Online tomorrow.

Ke_Xu_0-1750841754522.png

Thanks,

Ke

 

0 Kudos
JBH
by
Regular Contributor

Woohoo can't wait! Thanks Ke!

0 Kudos
DRamey
by
New Contributor

Is there a way to write the expression to display a certain message if no values appear in the field being referenced by dynamic text?

0 Kudos
AzizaParveen1
Esri Contributor

@DRamey 

Yes, you can do that using arcade expression as well

0 Kudos