Forum Discussion

BobSalaj's avatar
BobSalaj
Qrew Member
4 years ago

Clickable Icon to File Attachment

Does anyone have any example code for clicking an icon and having that go to a file attachment field? or bring up the image associated with that file attachment field?

------------------------------
Bob Salaj
------------------------------

6 Replies

  • The code is different to display an image vs open a file attachment.  Which do you want to do?   Can you explain your use case, that would help.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • RobSalaj's avatar
      RobSalaj
      Qrew Cadet

      The user will add a PDF file to a QuickBase Record. – lets call this a doctors note.

       

      I merely want to show an icon of a "note" in subsequent embedded reports. So if a Doctors note was added, show icon, otherwise leave blank. Then when you click the note icon, can it show the pdf that was added. 99% of the time it will be a pdf file.

       



  • try this
    var text Image = "<img src=https://images.quickbase.com/si/32/113-note.png>";
    var text URL = URLRoot() & "up/" & Dbid() &  "/a/r" & [Record ID#] & "/e130/v0"; 

    If([PDF Document]<>"", "<a href=" & $URL & ">" & $Image & "</a>")

    //  notes: replace the 130 with the fid of the file attachment field.
    // There are 502 icons here in 5 convenient sizes if you want an easy source of icons open to everyone on the internet. https://login.quickbase.com/db/9kaw8phg?a=ShowPage&pageid=160

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • RobSalaj's avatar
      RobSalaj
      Qrew Cadet

      We are close. The image shows broken, but when you click it, it downloads the PDF. Thanks!

       

      Troubleshooting the image piece now. Not sure why if it is open to everyone

       

      var text Image = "<img src=images.quickbase.com/si/24/113-note.png>";

      var text URL = URLRoot() & "up/" & Dbid() &  "/a/r" & [Record ID#] & "/e35/v0"; 

       

      If([Providers Note]<>"", "<a href=" & $URL & ">" & $Image & "</a>")

      Bob Salaj

       

      Direct

      724-820-1534

      Mobile

      412-335-8168

      Web

      LighthouseElectric.com

      http://lighthouseelectric.com/sites/lighthouseelectric.com/files/lighthouse_electric_email_logo.jpg

      http://lighthouseelectric.com/sites/lighthouseelectric.com/files/lighthouse_electric_email_facebook.jpghttp://lighthouseelectric.com/sites/lighthouseelectric.com/files/lighthouse_electric_email_linkedin.jpg

       



      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew Champion
        OK, let me know if you can't figure it out.  My formula was tested did work. I see you changed to a smaller size image, but that should still work.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------