Arcade - Hyperlink (from field) as text

11469
3
Jump to solution
01-24-2020 08:39 AM
AdamGebhart
Occasional Contributor III

I am trying to create an Arcade expression that inserts a hyperlink as text.  Is this possible just in Arcade or does this require html formatting in the popup?

Field = SampleBallotURL

I want my expression to show...

  If SampleBallotURL is empty or null, return "No sample ballot available at this time."

  Else (if it's not empty or null) return "Click <a href=Sample BallotURL>here</a> to view a sample ballot."

I've tried this, but you can see (in the images), the 'No sample...' portion works but the hyperlink does not appear as text where the condition is false.

IIF(IsEmpty($feature.SampleBallotURL),'No sample ballot available at this time.','Click <a href=$feature.SampleBallotURL>here </a> to view sample ballot.')


Can somebody point me in the right direction?  I've read some other posts that indicate I need to do some html work in the popup but I'm not sure how to do that and get it so that only one of these lines is returned.

I should add that when include quotation marks like in a normal <a href> they appear in the popup.

1 Solution

Accepted Solutions
AdamGebhart
Occasional Contributor III

Xander Bakker

Thank you.   I think I found a quick way of doing this without having to mess with the html.

Expression3

IIF(IsEmpty($feature.SampleBallotURL),'','To see a sample ballot click ')

 

Expression4

IIF(IsEmpty($feature.SampleBallotURL),'','here')

 

And this in the popup (minus all the other stuff that will go in it).

Popup configuration screenshot

Popup link property

View solution in original post

3 Replies
XanderBakker
Esri Esteemed Contributor

Hi agebhart_johnsoncounty ,

Currently Arcade does not support returning html (this will be possible in the future). For now you will have to use the custom html formatting in the pop-up.

AdamGebhart
Occasional Contributor III

Xander Bakker

Thank you.   I think I found a quick way of doing this without having to mess with the html.

Expression3

IIF(IsEmpty($feature.SampleBallotURL),'','To see a sample ballot click ')

 

Expression4

IIF(IsEmpty($feature.SampleBallotURL),'','here')

 

And this in the popup (minus all the other stuff that will go in it).

Popup configuration screenshot

Popup link property

XanderBakker
Esri Esteemed Contributor

Hi agebhart_johnsoncounty ,

Looks good. Here a link to another related discussion that includes html customization of the pop-up: Hyperlink within expression of pop-up in AGOL 

0 Kudos