Hello,
So I have a table with URL links if a specific boundary has a PDF map available for folks to download. I created an arcade expression to add the HTML link. Not all boundaries have a URL so needed some logic to return nothing if there is no URL. However, there are two square brackets that are showing up and I have no idea why.
The pop-up:
The code:
if ($feature.CLOSURE_MAP != ''){
if ($feature.Map_URL != '') {
var urls = Split($feature.Map_URL, ', ')var links = []for (var i in urls) {var url = urls[i]links += Concatenate(["<a href=", url, ">View Map</a>"])links += ""}return {type : 'text',text : links}}}
Solved! Go to Solution.
You are instantiating links as an array (line 6) but are using it as a string. Try this
if ($feature.CLOSURE_MAP != ''){
if ($feature.Map_URL != '') {
var urls = Split($feature.Map_URL, ', ')
var links;
for (var i in urls) {
var url = urls[i]
links += Concatenate(["<a href=", url, ">View Map</a>"])
links += ""
}
return {
type : 'text',
text : links
}
}
}
You are instantiating links as an array (line 6) but are using it as a string. Try this
if ($feature.CLOSURE_MAP != ''){
if ($feature.Map_URL != '') {
var urls = Split($feature.Map_URL, ', ')
var links;
for (var i in urls) {
var url = urls[i]
links += Concatenate(["<a href=", url, ">View Map</a>"])
links += ""
}
return {
type : 'text',
text : links
}
}
}