Select to view content in your preferred language

Pop-up: Link to URL with Link text; if empty return text No As-Built Document text

243
3
Jump to solution
04-02-2026 07:07 AM
GeoWorld13
Emerging Contributor

Hello - I would like to create a dynamic pop-up that links out to an As-Built document related to a feature. However, some features do not have any As-Builts and have empty values in the data. If that is the case, I want the pop-up to read: There is no As-Built Plan for this project.

What I have so far is an attribute expression:

if (IsEmpty($feature.Orignal_Project_PDF)) {
    return "There is no As-Built Plan for this project.";
} else {
    return '<a href="' + $feature.Orignal_Project_PDF + '" target="_blank">Link</a>';
}
 
Pop-up HTML:
<p>
<strong>📄 As-Built Plans:</strong><br>
{expression/expr4}
</p>
 
How ever my pop-up looks like this:
GeoWorld13_0-1775138758675.png

 

GeoWorld13_1-1775138787025.png

 

See anything I am doing wrong?

@jcarlson 

@KenBuja 

@RussRoberts 

0 Kudos
1 Solution

Accepted Solutions
Neal_t_k
MVP Regular Contributor

@GeoWorld13 

I just revisted and think I got it to work, instead of an expression and a text popup, just add an Arcade item and do all of it there:

Neal_t_k_0-1775224470292.png

add this code:

var nolink = "There is no As-Built Plan for this project."
var url1 = $feature.Orignal_Project_PDF
var base = ""
if (IsEmpty($feature.Orignal_Project_PDF)) {
    var base =  nolink;
} else {
    var base = '<a href='+url1+' target="_blank">Link</a>';
}

return { 
	type : 'text', 
	text : "<p><strong>As-Built Plans:</strong><br>"+base+"</p>"
}

 

View solution in original post

3 Replies
Neal_t_k
MVP Regular Contributor

This gets you closer, however it formats the static text as a link as well...

The expression:

if (IsEmpty($feature.Orignal_Project_PDF)) {
    return "There is no As-Built Plan for this project.";
else {
    return  $feature.Orignal_Project_PDF;
}

 

Then to add that in the popup add text and insert your expression as a link and put in your expression name.

Neal_t_k_0-1775147156196.png

HTML: 

<p>
<strong>As-Built Plans:</strong><br>
<a href="{expression/expr0}">{expression/expr0}</a>
</p>

Reference:  Solved: Re: Arcade add URL to pop-up - Esri Community

0 Kudos
Neal_t_k
MVP Regular Contributor

@GeoWorld13 

I just revisted and think I got it to work, instead of an expression and a text popup, just add an Arcade item and do all of it there:

Neal_t_k_0-1775224470292.png

add this code:

var nolink = "There is no As-Built Plan for this project."
var url1 = $feature.Orignal_Project_PDF
var base = ""
if (IsEmpty($feature.Orignal_Project_PDF)) {
    var base =  nolink;
} else {
    var base = '<a href='+url1+' target="_blank">Link</a>';
}

return { 
	type : 'text', 
	text : "<p><strong>As-Built Plans:</strong><br>"+base+"</p>"
}

 

GeoWorld13
Emerging Contributor

@Neal_t_k this worked, thanks!

0 Kudos