Create links to pdfs of surveys

1203
7
08-05-2021 03:39 PM
WahkiakumGIS
New Contributor III

I published a survey index layer on my web app and would like to link the survey documents as pdfs.

Can I do this through web app builder?

If so can it be an internal server link, or does it have to be a web link?

Do the pdfs have to be stored in my arc gis online account?

I have about 1200 surveys.

 

This is what my map looks like, I want it to link to the document number in the pop up window.

LorraineFuller_0-1628201785268.png

 

The county next door has their surveys linked on their web app, but they are using a paid service to create the links an we don't have a budget to do that.

When you click view document it opens the pdf

LorraineFuller_1-1628202156105.png

 

Thank you!

0 Kudos
7 Replies
AlfredBaldenweck
MVP Regular Contributor

You can create a workable hyperlink with the following syntax in a text field.

 

<a href="file://filepath" target="_top">hyperlinkname</a>

 

This only works in a pop-up if you have the hyperlink name, so beware. It works for any sort of hyperlink; I use it to get files off my hardrive, as well as web URLs.

The simplest thing to do, I think, is to add a new field to your feature class and populate it with hyperlinks. Alternatively, you can make a table with a Recording Number field and a hyperlink field, then join it to the feature class you already have (you can do this in AGOL directly).

You can use Excel to generate all the file paths with this macro (I think I got this here?)

 

Sub GetFileList()
Dim xFSO As Object
Dim xFolder As Object
Dim xFile As Object
Dim xFiDialog As FileDialog
Dim xPath As String
Dim i As Integer
Set xFiDialog = Application.FileDialog(msoFileDialogFolderPicker)
If xFiDialog.Show = -1 Then
xPath = xFiDialog.SelectedItems(1)
End If
Set xFiDialog = Nothing
If xPath = "" Then Exit Sub
Set xFSO = CreateObject("Scripting.FileSystemObject")
Set xFolder = xFSO.GetFolder(xPath)
ActiveSheet.Cells(1, 1) = "Folder name"
ActiveSheet.Cells(1, 2) = "File name"
ActiveSheet.Cells(1, 3) = "File extension"
ActiveSheet.Cells(1, 4) = "Date last modified"
i = 1
For Each xFile In xFolder.Files
i = i + 1
ActiveSheet.Cells(i, 1) = xPath
ActiveSheet.Cells(i, 2) = Left(xFile.Name, InStrRev(xFile.Name, ".") - 1)
ActiveSheet.Cells(i, 3) = Mid(xFile.Name, InStrRev(xFile.Name, ".") + 1)
ActiveSheet.Cells(i, 4) = CDate(xFile.datelastmodified)
Next
End Sub

 

It will prompt you to open a folder, and then it will list all the files in the folder in the columns  Folder name, File name, extension,  and date modified. 

From there, you can concatenate them into your desired file path

 

=CONCATENATE($G$1,A2,"\",B2,".",C2,$H$1,B2,$I$1)

 

AlfredBaldenweck_1-1628211278908.png

 

 

Actually, now that I've thought on this more, making it as a separate table that you join is probably going to be less labor-intensive; just Excel--> Table and upload it.

Hope this helps!

0 Kudos
WahkiakumGIS
New Contributor III

Thank you very much for the detailed instructions, I really appreciate it! I will try to do this and will let you know how it goes.

0 Kudos
WahkiakumGIS
New Contributor III

Do you know how to figure out what the hyperlink name is?

When I export the surveys it comes with an excel table like this:

LorraineFuller_1-1628285680568.png

 

Here are the pdfs in the extract folder:

LorraineFuller_2-1628285719063.png

I have tried lots of different things for the hyperlink name. 

My attribute table in arc pro:

LorraineFuller_3-1628285806857.png

but they all just redirect me back to the web app in a new window.

LorraineFuller_4-1628285882900.png

 

If I don't use the link and just paste the file path in the cell, it doesn't create a hyperlink, but I am able to copy and paste the link in my browser and the pdf will open.

LorraineFuller_5-1628285994219.png

 

file:///C:/reports/EXTRACT242S10/2028778-0.pdf

 

 

0 Kudos
AlfredBaldenweck
MVP Regular Contributor

Hey Lorraine, it looks like your hyperlink is missing part of the file path. 

Your screenshot shows

<a href="C:\reports\EXTRACT232S9" target="_top">2028778-0</a>

instead of 

<a href="C:\reports\EXTRACT232S10\2029778-0.pdf" target="_top">2028778-0</a>

0 Kudos
WahkiakumGIS
New Contributor III

I tried this, but it still was just opening the web app again when I clicked on the link.

LorraineFuller_0-1628287079506.png

 

0 Kudos
AlfredBaldenweck
MVP Regular Contributor

Okay, it looks like I gave you bad information.

So, speaking from my own experience, you can link to a hard drive on Pro. I assumed it'd work for AGOL, but it does not; I did some testing and it only takes weblinks. So if you have everything hosted on a sharepoint or Google Drive with sharing activated, that's viable.

Another alternative to this is attaching each document to the records in AGOL, which I'm sorry for not suggesting earlier. Depending on the number of records you have, this might be pretty labor intensive, but it's also a lot simpler.

0 Kudos
WahkiakumGIS
New Contributor III

Thanks for the quick response! I'll talk to our it department on Monday to ask if I can store the data on sharepoint or google drives. Then if that doesn work I can try your next suggestion.

Thanks again for your help, I appreciate it!

0 Kudos