Skip to main content
Question

URL Formula to open file attachment

  • February 15, 2016
  • 0 replies
  • 900 views

Ok - I may be missing something easy here, but I need help.


I have a file attachement field that may or may not have a pdf attached.  Is it possible to have a URL Formula (so I can have a button) that will show up only IF there is an attachment and the URL would be a link to that attachment?


If it's not possible to have it show up only if there is an attachment - what would the formula be to link to that field either way?  - I know there is the link that is the file name, but I really just want it to show up as a button.


Thanks!

This topic has been closed for replies.

KeithJusas
Forum|alt.badge.img+7
  • Registered
  • February 16, 2016
try this....assuming the name of the file attachment field is Document

create a new field, type should be formula text - check off "allow html"

if ([Document]>"", "<a href=\"" &URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#]& "/e999\"target=_blank\">" & [Document]& "</a>","")



change the 999 in e999 to be the field id of the Document field



Keith

Beautiful! Works perfectly - is there any way to get it to show up as a button?  Thank you!!

KeithJusas
Forum|alt.badge.img+7
  • Registered
  • February 16, 2016
change the field type to formula URL and check off display as a button

Unfortunately when I do that, the URL quits working.... I didn't change anything else at all!
would it be possible/easier to use an icon?

  • Registered
  • March 10, 2016
[mention://553 @keithj16] This is working for me, but when I try to pull this record into a child record it won't work because it references the child table DBID, Record Id and field ID. Is there a way to change that to reference the parent ID within the formula?

KeithJusas
Forum|alt.badge.img+7
  • Registered
  • March 10, 2016
yes..just change dbid() to the actual id of the master table...
2 ways.....1 hardcode the master table id or 2 use the master tables alias name
1.  "up/bbbbbbbbb/a/r"
2.  "up/" & [_DBID_MASTERTABLE] & "/a/r"

KeithJusas
Forum|alt.badge.img+7
  • Registered
  • March 10, 2016
oh... and use the Reference field from the Master table relationship instead of [record id#]
change [Record ID#] to [Related Master]

  • Registered
  • March 30, 2017
I may have 4 different documents in the table.  Is it possible to open one in the dashboard using a 4 button? 

Yes, just make 4 Dashboard buttons, each will be a URL type and you paste in the URL link you need once you have either exposed the URL in the formula field or else copy the URL from your Browser when looking at the result of clicking the button and copy and paste it into the URL for the button.

Thanks Mark.  I think you created one button for me (and I can see the URL in this button). If I were to create a new button, where do I get the URL.  I am somewhat confused when you say 'expose the URL'.     

By expose he URL, I simply mean to remove the label of the button and also to uncheck "Show as Button". That way you will see the URL and be able to copy and then paste it.

Thanks I got it.