Hello guys, I am hoping someone can help me un-rig this code.
Basically I am working to add a hyperlink to my tooltips, no problem I was easily able to add it.
The hyperlink I am using is from a vendor and some of my items in the layer do not have a hyperlink. So it is displayed on every one of my items whether there is data for a link or not. This wouldnt be a big deal except for when there is not data for a link it blows up the webpage and the user loses their map view settings they where currently at.
I am wondering if there is a way to code it as an if there is data for a link then display hyperlink; if not then dont display hyperlink.
Here is what I have rigged up (very ugly and I dont like it):
'\n', '<a href=' , diLink , ' target="_blank">DI LINK</a>', ' ....do not click unless ( ', Length (diLink), ' ) > 0')
bsically I have it count the characters and spit out the # and tell them that 0 means there is not data.... This is ugly and really just not very professional.
Any ideas? I want to clean this up =)
If the function is available in the expression editor, use the If() function
If ( [condition], [value-if-true], [value-if-false] )
So something like this:
If ( Length(diLink) > 0, Concat('<a href="', diLink , '" target="_blank">DI LINK</a>'), '')
Will give you the hyperlink HTML if diLink isn't empty and an empty string if it is
Access a broad range of knowledge to help get the most out of your products and services.