Discussions

Expand all | Collapse all

URL Formula to open file attachment

Arshad Khwaja05-24-2017 23:03

  • 1.  URL Formula to open file attachment

    Posted 02-15-2016 15:10

    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!



  • 2.  RE: URL Formula to open file attachment

    Posted 02-15-2016 19:08
    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


  • 3.  RE: URL Formula to open file attachment

    Posted 06-28-2017 19:04
    Hi Keith,

    When I do this, the document downloads and the user still has to click the downloaded file on the bottom left of their screen in order to view the document.

    Functionality-wise, there is no difference between this approach and the link that Quick Base creates when adding a field of type "File Attachment" .

    Is there no way to make it so that the document opens instantly when clicking the link, therefore eliminating that second click?

    Thanks in advance.


  • 4.  RE: URL Formula to open file attachment

     
    Posted 05-01-2018 13:59
    Hi Keith,
    This works perfect when is empty, but when I have a file the link shows but with the formula. Is there any way for the formula not to show?


  • 5.  RE: URL Formula to open file attachment

    Posted 02-15-2016 19:32
    Beautiful! Works perfectly - is there any way to get it to show up as a button?  Thank you!!


  • 6.  RE: URL Formula to open file attachment

    Posted 02-15-2016 20:00
    change the field type to formula URL and check off display as a button


  • 7.  RE: URL Formula to open file attachment

    Posted 02-15-2016 20:16
    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?


  • 8.  RE: URL Formula to open file attachment

    Posted 03-09-2016 20:30
    [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?


  • 9.  RE: URL Formula to open file attachment

    Posted 05-01-2018 15:02
    @Gina: I noticed you had a WebMention to Keith. I am curious how you inserted that mention or what program you used to do it.


  • 10.  RE: URL Formula to open file attachment

    Posted 03-10-2016 00:52
    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"


  • 11.  RE: URL Formula to open file attachment

    Posted 03-10-2016 00:55
    oh... and use the Reference field from the Master table relationship instead of [record id#]
    change [Record ID#] to [Related Master]


  • 12.  RE: URL Formula to open file attachment

    Posted 03-30-2017 02:48
    I may have 4 different documents in the table.  Is it possible to open one in the dashboard using a 4 button? 


  • 13.  RE: URL Formula to open file attachment

    Posted 03-30-2017 09:57
    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.


  • 14.  RE: URL Formula to open file attachment

    Posted 05-24-2017 22:50
    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'.     


  • 15.  RE: URL Formula to open file attachment

    Posted 05-24-2017 22:55
    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.


  • 16.  RE: URL Formula to open file attachment

    Posted 05-24-2017 23:03
    Thanks I got it.