Select to view content in your preferred language

Custom Hyperlink Display

979
5
Jump to solution
08-19-2024 10:29 AM
Labels (2)
EdColeman
Emerging Contributor

Good afternoon,

I'm sure there must be a simple explanation for this, but I'm having trouble figuring it out.  I have a hosted web layer containing polygons listing a projects name, type, division, status and a hyperlink to the associated project document.  However, I've been asked to change default displayed "More info" for the hyperlink to something more descriptive.

I'm new to Arcade and don't know where to look, so I'm turning to the community.  Please, if you are able, could someone point me in the right direction? 

Thanks in advance for your time,

Edward

 

0 Kudos
2 Solutions

Accepted Solutions
jcarlson
MVP Esteemed Contributor

You'd just replace "$feature.url" with the actual field name, in your case, $feature.link.

Based on your first screenshot, though, it looks like the map is being used in a WebAppBuilder app or the Map Viewer Classic? Those are running on a different JS API, and won't be able to render Arcade popup elements at all.

On the older tools, you're limited to either a single field list, in which the link says "more info", or you have to convert the whole thing to a text element.

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
EdColeman
Emerging Contributor

Wow.  That worked.  I'm having to deal with data and projects that a former employee created and didn't bother to update.  Thank you so much for the help and advice!  I will create a new viewer for this one using current tech.  I appreciate you taking the time to help me out.

View solution in original post

0 Kudos
5 Replies
Nick_Creedon
Frequent Contributor

I haven't used Arcade for pop-ups too much, I have used the text field to customize field organization and hyperlink selection. Here are some snippets of what I have accomplished. With these hyperlinks I can give them any name. You can also stack the regular pop-up with a hyperlink text below. I think adding the text pop-up and adding your hyperlink there and going into the source text to manipulate the title would give you a similar outcome.

Screenshot 2024-08-19 133939.png

Screenshot 2024-08-19 134837.png

0 Kudos
jcarlson
MVP Esteemed Contributor

@Nick_Creedon's solution works for generating a link with whatever text you need inserted into the link.

In order to get the link into a field list popup, you'll need to add an Arcade popup element, like this:

return {
  type: "fields",
  fieldInfos: [
    { fieldName: "Name" },
    { fieldName: "Type" },
    { fieldName: "Division" },
    { fieldName: "Status" },
    { fieldName: "Link" },
  ],
  attributes: {
		Name: $feature.name,
		Type: $feature.type,
		Division: $feature.division,
		Status: $feature.status,
		Link: `<a href="${$feature.url}">PROJECT LINK TEXT</a>`
	}
};

 Swap in the field names with your own as needed.

jcarlson_0-1724094265937.png

 

- Josh Carlson
Kendall County GIS
EdColeman
Emerging Contributor

Thanks for your input, Josh.  Unfortunately, I still can't seem to get it to work.  

Currently, this is the output I'm getting.  I just need to change the link text, which you know.

This is the current output.This is the current output.

These are the available attributes of the dataset, of which I only need 5.

issueb.png

When I sub in the information as you've recommended, I get an error at line 15:

issuec.png

I'm assuming I'm missing some information for $feature.url.  The urls are all listed in the $feature.link.  Do I need to create something new in order to get this to work?  Because subbing $feature.link for the $feature.url isn't working either.  Please advise.  Thanks in advance for your help.

0 Kudos
jcarlson
MVP Esteemed Contributor

You'd just replace "$feature.url" with the actual field name, in your case, $feature.link.

Based on your first screenshot, though, it looks like the map is being used in a WebAppBuilder app or the Map Viewer Classic? Those are running on a different JS API, and won't be able to render Arcade popup elements at all.

On the older tools, you're limited to either a single field list, in which the link says "more info", or you have to convert the whole thing to a text element.

- Josh Carlson
Kendall County GIS
0 Kudos
EdColeman
Emerging Contributor

Wow.  That worked.  I'm having to deal with data and projects that a former employee created and didn't bother to update.  Thank you so much for the help and advice!  I will create a new viewer for this one using current tech.  I appreciate you taking the time to help me out.

0 Kudos