How do I create a Formula-URL in a parent table to link to an attachment in specific child record?

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
I would like to create a field in a parent table that displays a hyperlink to a file attachment in the most recent child record.  I have already created a summary field that finds the Record ID# of the target child record.  Knowing the child record ID and the field ID that holds the file attachment, how do I write the equation for the hyperlink?
Photo of David Sirrine

David Sirrine

  • 170 Points 100 badge 2x thumb

Posted 4 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,558 Points 50k badge 2x thumb
The URL formula would be this

URLRoot() & "up/" & [_DBID_DOCUMENTS] & "/a/r" & [Focus Document Record ID#] & "/e11/v0"


the e11 means that the file attachment is in field ID11.
The [_DBID_DOCUMENTS] needs to be the table name from advanced properties where the file attachment is stored.

If you wanted a hyperlink to allow display the file name, then that is another question and a bit fancier answer, but regardless, get this working first.

Photo of David Sirrine

David Sirrine

  • 170 Points 100 badge 2x thumb
Thanks! I got it to work with this formula:

URLRoot() & "up/" & [_DBID_ZWZ_Dwg_Revisions] & "/a/r" & [Maximum Record ID#] & "/e13/v0"

You also accurately anticipated my next need: having the link display as the name of the file attachment rather than the actual link.  How do I do this?

Also, if the target field has no attachment, I'd like the result of the formula to be blank.
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,558 Points 50k badge 2x thumb
:) OK  hyperlink.

So a hyperlink basically consists of the URL to go to, which you have  mastered, plus some words to click on.  So we need the words.  We can make use of the recent December 2018 feature to summarize text up to a parent.

Make a formula text field on the child record  as ToText([my file attachment field])

You have the [Maximum Record ID#] field up on the Parent.  Look that up down to the children.

Make a Summary Combined text field on the relationship to summarize the file name words, subject to the filter that the [Record ID#] =  [Maximum Record ID#]

(ie there will only be 1 lucky qualifying record to Summarize) 

Finally make the Hyperlink field as a formula Rich Text field.

var text URL = [insert the URL field that you previous got working];
var text Words = ToText([My Summary Combined text field]); 

"<a href=" & $URL & ">" & $Words & "</a>





(Edited)
Photo of David Sirrine

David Sirrine

  • 170 Points 100 badge 2x thumb
Great! This worked and did everything that I was looking for.  Thank you.