Hide Button if no data

01-24-2022 10:07 AM
Regular Contributor

I'm using a BUTTON in ExpBuilder to reference a URL link in an attribute field for the selected feature.  If the field is BLANK (i.e. does not contain a hyperlink) I would like to either hide/disable the button OR display some alternate text (i.e. "No content for this feature").  Otherwise the button just doesn't do anything at all when the user clicks it, which could be confusing.  Any way to do this?

Washoe County GIS
3 Replies
Esri Contributor

Hi @JayJohnsonWashoeCounty ,

When you connect a button widget to a data source, you can also use Attribute or Expression for the button text.


You can use the Expression and change the expression title to no data message.




Occasional Contributor II

It would be extremely helpful if there was an option here to also disable (gray out) the button if there is no data available. 

0 Kudos
Regular Contributor

I guess if I had a field that contained text useful as a button label that would work, but that isn't my situation.  And still, that doesn't really disable the button, which would be preferable.

If I could put some useful logic in that button Expression along the lines of:  IIf (IsEmpty($feature.field1), "No Data", "Click Me"), where I'm using field1 to store a URL used by SetLink, that would be closer to useful.  But it looks like the Expression box won't take Arcade expressions(?).

My alternate solution was to leave the button as-is and instead set a default value for the field SetLink refers to.  This default value is a URL that points to a web page that displays a "No data for this feature" message.  So the button only functions meaningfully if the editor replaces the default value with a good URL.  In my case, the good URL points to a Survey123 form.

Washoe County GIS