Select to view content in your preferred language

Using Arcade to return a hyperlink from another Table

782
2
Jump to solution
07-22-2021 10:17 AM
AlfredBaldenweck
MVP Regular Contributor

Follow-up to this question Solved: Re: Relating Table A to Table D via Tables B and C - Esri Community

I got the expression working great, but it when it tries to return a field with hyperlinks  E.g.

 

<a href="C:\Users\USER\Documents\ArcGIS\Projects\testing\Documents_testing\Lorem Ipsum.docx" target=_top">Lorem Ipsum.docx</a>

 

it returns a blank.

I looked into it and found this post, but I've had a lot of trouble implementing it.

I've tried making a new field with just the blank file path, then adding the html formatting to the final bit that's pushed , but that doesn't return anything either. 

 

var docs = []
for(var a in filtered_a) {
  Push(docs, "<a href="'+a.File_Path+'"</a>")
}

 

Is there a way to have the expression return hyperlinks? 

Thanks!

1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Once you have your docs array, try this:

var out_str = ''

for(var d in docs){
    out_str += docs[d] + ' | ' //or the separator of your choice
}

return out_str

jcarlson_1-1626975269504.png

 

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

Once you have your docs array, try this:

var out_str = ''

for(var d in docs){
    out_str += docs[d] + ' | ' //or the separator of your choice
}

return out_str

jcarlson_1-1626975269504.png

 

- Josh Carlson
Kendall County GIS
0 Kudos
AlfredBaldenweck
MVP Regular Contributor

That worked great!

Word for anyone who tries this in the future: Make sure that your hyperlink field includes an alias for the link, or else only your separators will show up. They will link correctly, but you won't be able to tell what they are by looking.

 

Thanks again!

Edit 8/12/21:

Use "<br>" if you want a new line; HTML will not take TextFormatting.NewLine

0 Kudos