Hyperlink Field — Replace spaces with URL-encoded value “%20”

830
3
09-26-2023 01:02 PM
Status: Open
Bud
by
Notable Contributor

Oracle 18c 10.7.1 EGDB:

This isn't my area of expertise; I'm posting this idea because it's an issue my organization dealt with recently. I'll try to explain it as well as I can.


I have a FC that has a FILE_URL field. The values in the field are URLs to on-prem files, such as:

  1. http://a.b.c.on.local/DRAWINGS/A123.PDF
  2. http://a.b.c.on.local/DRAWINGS/B 123.PDF


Identify tool:

In a web map, when using the identify tool, URL #1 works as a clickable hyperlink because the file name doesn't have spaces. But URL #2 is not a clickable hyperlink, it's just plain text because the file name has a space. 

Attribute Table widget:

Additionally, while URL #2 is technically a hyperlink in the Attribute Table widget, the hyperlink is broken/incorrect: http://a.b.c.on.local/DRAWINGS/B 123.PDF. The hyperlink incorrectly excludes the portion of the URL that comes after the space in the hyperlink.


We can workaround the identify window issue by using an Attribute Expression (Arcade) to replace spaces with “%20”: 

return Replace($feature["FILE_URL"]," ","%20")

However, that expression doesn't get applied in the Attribute Table, so the Attribute Table hyperlink is still broken.

We might have the option to work around this issue in the underlying data (by replacing spaces with “%20” in a field):

  1. Use a calculation attribute rule to populate an additional field in the FC
  2. Or use a calculated SQL field in a database view (note: layers based on database views are read-only/uneditable)

However, those workarounds add unwanted complexity.


Idea:

Could OOTB functionality be added to the web map that automatically replaces spaces in the URL with the encoded value “%20” ? That would be the cleanest way of ensuring URLs with spaces work correctly as hyperlinks in web maps.

Related: Arcade expression in attribute table widget

3 Comments
SSWoodward
Status changed to: Needs Clarification

@Bud so I can fully understand.  The FILE_URL field, is a plain text field in your feature class?

Bud
by

@SSWoodward Yes.

SSWoodward
Status changed to: Open