Help with custom Arcade expressions

762
2
02-21-2020 07:12 AM
DaveK
by
Occasional Contributor

Hello, 

I am trying to create a custom popup using Arcade expressions that shows upcoming park events. I have an expression that allows a field containing URL's to be displayed in the popup if it is not null (Image 1). This works just fine within my popup but I cannot figure out how to change the visible text from showing the URL link to link text (example 2). In my popup, I would like the link URL to have the text "Click Here for More Info or to Sign up" like the first URL link. Does this need to be done within the Arcade expression? 

Image 1

Image 2

{expression/expr15} is the Arcade expression that I would like to display the link text 

If I change the Link Text here, it displays the text even if the field does not contain a URL. 

0 Kudos
2 Replies
XanderBakker
Esri Esteemed Contributor

Hi David Krady ,

You will probably need to enter the HTML format of the link and combine it with some tags that influence the visibility (as explained here: Conditional Field display with Arcade in Pop Ups (revisited) ).

To enter the html, you have to activate it using the button indicated with the red color: 

A link in html will normally look like, where  you will see the URL and the actual text being shown:

<a href="https://www.w3schools.com">Visit W3Schools.com!</a>

If you combine this with what you are trying to accomplish and the description in the link above, you could create something like this:

<a href="{URLFieldName}" style="display:{expression/expr0}>Click Here for More Info or to Sign up</a><span style="display:{expression/expr1}>No link available...</span>‍‍

In the example above:

  • you will specify the field with the hyperlink "{URLFieldName}"
  • the expression/expr0 (numbers will be different in your case) will be a simple expression that checks if a field is empty or not and returns block or none (see example in link)
  • On the second row the expression/expr1 will do the opposite and show a alternative text when you don't have a link. This is optional.
0 Kudos
ChrisSmith7
Frequent Contributor

Can you try adding another expression checking for null, only returning the "click here" text if the URL is populated?

0 Kudos