Link not displaying in conditional field display

3696
16
Jump to solution
09-20-2017 09:25 AM
JaredPilbeam1
Occasional Contributor

Thanks to this recent blog post: https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/18/conditional-field-disp... 

I have a bunch of points on my web map that are tourist attractions. Some have websites available, some do not. But, they're all in the same attribute table. I have a "URL" field, and when relevant there's a url to the website. This is where the post came in handy. I was able to copy the conditional Arcade line and HTML code that I tailored to my app.

The only thing is that my attribute field is dealing with a link. It's currently showing up as text on the pop-up (visible in the background here). It doesn't seem to be a case of using the link tool in the Custom Attribute Display window because most are individual links. Would you have an idea how to configure it so the link is live?

0 Kudos
16 Replies
RobertScheitlin__GISP
MVP Emeritus

Jared,

   That is strange as the 

{expression/expr0}

should now only be returning an html anchor string if there is anything in the URL field otherwise it is returning an empty string. So what does your Custom attribute display dialog look like now?

It should just be:

Name:       {NAME}
Address:   {FAC_ADDY_1}
                 {CITY_ST_ZIP}
{expression/expr0}

0 Kudos
JaredPilbeam1
Occasional Contributor

Here's the display:

Here's the HTML:

<table cellpadding="0px" cellspacing="3px">
     <tbody>
           <tr valign="top">
               <td><b>Name:</b></td>
               <td><span>{NAME}</span> 
               </td>
            </tr>
            <tr valign="top">
               <td><b>Address:</b></td>
               <td>{FAC_ADDY_1}</td>
            </tr>
            <tr valign="top">
              <td><br /></td>
              <td>{CITY_ST_ZIP}</td>
            </tr>
           <tr valign="top">
               <td><b>{/expr0}<a href="{URL}" target="_blank">Website</a>
               </b></td><td><br /></td>
           </tr>
      </tbody>
</table>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Here's the Arcade expression:

IIF(IsEmpty($feature.URL), '', '<a href="{URL}" target="_blank">Website</a>')

You'll notice in the screen shot a popup in the background. It's a popup that shouldn't have a link as there's nothing in the URL field for it.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

So what you should have in the html is just:

<table cellpadding="0px" cellspacing="3px">
     <tbody>
           <tr valign="top">
               <td><b>Name:</b></td>
               <td><span>{NAME}</span> 
               </td>
            </tr>
            <tr valign="top">
               <td><b>Address:</b></td>
               <td>{FAC_ADDY_1}</td>
            </tr>
            <tr valign="top">
              <td><br /></td>
              <td>{CITY_ST_ZIP}</td>
            </tr>
           <tr valign="top">
               <td><b>{expression/expr0}</b></td>
               <td></td>
           </tr>
      </tbody>
</table>
0 Kudos
JaredPilbeam1
Occasional Contributor

Hi Robert,

After talking with Esri, I found out there was an existing bug behind this behavior:

BUG-000106245: When using a custom attribute display pop-up with a hyperlink field, null values in the hyperlink field result in a link to the current web map.

This was supposedly fixed at the latest release of AGOL they say. The behavior I'm experiencing with the text appearing in the pop-up for fields with null values, even though the Arcade expression tells it otherwise is a new defect. So, they're looking into it. It sounds like, once treated, the URL field will display the hyperlink when present and nothing when the field's null, thereby eliminating the need for the Arcade expression.

MalcolmJ
Occasional Contributor II

Does anyone know if this has been fixed? I'm trying to do the same thing as the original poster but I'm running into the same problems. The bug still appears to exist. Anyone have any updates?

0 Kudos
SarahEllis2
New Contributor

Jared Pilbeam‌ I am still having this issue. I check the bug status and it says it was updated Sep 2019. However, when I try to create a conditional hyperlink, the link text always shows, even when there is no URL. Any solutions for this?

0 Kudos
by Anonymous User
Not applicable

So I had a similar problem in my web map as I only wanted traffic cameras that have an IP address to show a link, and for those that do not, nothing. This was my work around.

1)Create two Arcade Expressions, one for the conditional field display, and one for a conditional link display.
Here is the conditional field display {expression/expr0}

IIF(IsEmpty($feature.CameraIP), '', "Traffic Camera")

 Here is the conditional link display named {expression/expr1}

IIF(IsEmpty($feature.CameraIP), '*No Camera Installed*', "Live View")

 2) I modified my Customer Attribute display where my field expression is on the left and my link expression is on the right, highlight the link expression and click on the link icon (chain link) :

GeneSipes_0-1611869400491.png

3) The link window opens and I put my link expression in the "Text" parameter and my camera IP field in the "URL" parameter.

GeneSipes_1-1611869583314.png

Results:

Traffic Signal with  a Camera:

GeneSipes_2-1611869660250.png

 

Traffic Signal WITHOUT a Camera IP:

GeneSipes_3-1611869695764.png

 

I hope this helps! Shout out to Bernard Szukalski for giving me some direction to go on this solution.