Hide Button if no data

1284
4
01-24-2022 10:07 AM
JayJohnsonWashoeCounty
Occasional Contributor III

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?

Jay
Washoe County GIS
4 Replies
ShengdiZhang
Esri Regular Contributor

Hi @JayJohnsonWashoeCounty ,

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

ShengdiZhang_0-1643076328524.png

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

 

Regards,

Shengdi

AndyWells
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. 

AndyWells
Occasional Contributor II

Update. This is still a problem. I have a button that goes to an EXB window. I don't want to open that window if there is no active selection, because there will be no data to display in the window (and the format is too complicated to replace it all with an expression that has a default message for no data). I would love to restrict it so that there is always a selection, then the button could always open the window, but because of a different issue, the user can always simply click on the map which clears the selection, thus setting the selection to nothing. 

I will put in an "idea" about it.

JayJohnsonWashoeCounty
Occasional Contributor III

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.

Jay
Washoe County GIS