Forum Discussion

MichaelTamoush's avatar
MichaelTamoush
Qrew Captain
5 years ago

URL Button to Preview File

I have a file attachment and I'm looking to make a button for the user to preview the file attachment. I found an old thread about this suggesting the following, however when I click that I get a url cannot be found web page. Also, it opens in the same tab as quickbase, and I am hoping to open in a new tab. Can anyone help? Thanks!

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



------------------------------
Mike Tamoush
------------------------------
  • Reach out to Ryan Stanford, he was able to do it. Check out the last entry of this thread:
    video in pop up window

    ------------------------------
    Adam Keever
    ------------------------------
    • BabiPanjikar's avatar
      BabiPanjikar
      Qrew Assistant Captain
      @Adam keever, thanks for resharing the post. This is useful. I had the similar requirement recently to open the file itself when clicked. However, due to native, it only got download instead. I was using excel/word/ppt and pdf files. ​

      ------------------------------
      Babi Panjikar
      ------------------------------
      • SrinathM_R2's avatar
        SrinathM_R2
        Qrew Member
        I guess It's a bit late but I am using this option to preview the files and it works well for me. 
        Field = Formula URL

        var text url = URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e6/v0";
        var text doctype = Right(Right(ToText([File]), "/"), ".");
        If ($doctype = "pdf" or $doctype = "doc" or $doctype = "PDF" or $doctype = "DOC" or $doctype = "xls" or $doctype = "xlsx" or $doctype = "pptx" or $doctype = "docx", "https://docs.google.com/gview?url="&$url&"&embedded/=true",URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e6/v0")

        Places where you have e6 insert the field I.D instead of 6 and if you come across any other document type that you are using then just add it's extension to the doc type and it should be good.

        ------------------------------
        Srinath MR
        ------------------------------
  • try this

    IF(ToText([Document]) <>"",
    "<a target='_blank' href=" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/
    e999/v0"  & ">" & Totext([Document]) & "</a>")

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      .. field type would be Formula Rich Text

      ------------------------------
      Mark Shnier (YQC)
      Quick Base Solution Provider
      Your Quick Base Coach
      http://QuickBaseCoach.com
      markshnier2@gmail.com
      ------------------------------
      • MichaelTamoush's avatar
        MichaelTamoush
        Qrew Captain
        That works but just downloads it. I suspect it would be a preview if I changed my chrome settings, but Im trying to come up with something where it just works without changing the settings. Also would be great if it was a url formula so i could make it a button.

        ------------------------------
        Mike Tamoush
        ------------------------------