Forum Discussion
_anomDiebolt_
8 years agoQrew Elite
First of all, you can do this natively and what can't be done natively can be done with script. Second of all you should endeavor to do everything you can within QuickBase before resorting to external services. I am sure Workao is a fine product but a best practice that you should keep at the top of your list st to minimize the number of external services you employ as it just creates more potential points of failure and additional cost.
You can do this with a plain old native boring formula rich text field. It is painful for me to answer with a native solution and not use script but alas some of you mistakenly think native is easier to use then script.
In the following formula I am forcing the downloaded file to have a base file name of "myfile" while preserving the original extension of the [file] file attachment field field (pdf, mpeg, etc)
See screenshot taken after clicking both hyperlinks (note file name in download area):
Notes:
(1) You will have to substitute your dbid and subdomain.
(2) My formula assumes you only have one versoin of the file attachment field
(3) You might have to play with the logic a bit to get your desired download behavior in consideration of the specific types of files you will be downloading and the desired name you want to assign.
(4) BTW, you can download any content whatsoever as a file WITHOUT having a file attachment field.
(5) This formula uses the download attribute of the <a> element to force the renaming of the file to the value specified. In some cases the MIME type (extension) may be overridden by a server sent header and there may be different behavior in the various browser (I only tested this in Chrome). If you use this formula do everyone a favor and report your success by testing your implementation in the various browser.
(6) Here is a resource to help you understand using the download attribute:
https://davidwalsh.name/download-attribute
You can do this with a plain old native boring formula rich text field. It is painful for me to answer with a native solution and not use script but alas some of you mistakenly think native is easier to use then script.
In the following formula I am forcing the downloaded file to have a base file name of "myfile" while preserving the original extension of the [file] file attachment field field (pdf, mpeg, etc)
var Text fileName = Part([file], 1, ".");
var Text fileExtension = Part([file], 2, ".");
"<a href='https://haversineconsulting.quickbase.com/up/bnddv44yh/g/r"; & [Record ID#] & "/f6/v0/' download='myfile." & $fileExtension & "'>Download myfile." & $fileExtension & "</a>"
See screenshot taken after clicking both hyperlinks (note file name in download area):
Notes:
(1) You will have to substitute your dbid and subdomain.
(2) My formula assumes you only have one versoin of the file attachment field
(3) You might have to play with the logic a bit to get your desired download behavior in consideration of the specific types of files you will be downloading and the desired name you want to assign.
(4) BTW, you can download any content whatsoever as a file WITHOUT having a file attachment field.
(5) This formula uses the download attribute of the <a> element to force the renaming of the file to the value specified. In some cases the MIME type (extension) may be overridden by a server sent header and there may be different behavior in the various browser (I only tested this in Chrome). If you use this formula do everyone a favor and report your success by testing your implementation in the various browser.
(6) Here is a resource to help you understand using the download attribute:
https://davidwalsh.name/download-attribute
QuickBase9
8 years agoQrew Cadet
Hey Dan, was hoping you could help me get to the next level with this. If the file you are downloading is not an uploaded file, but the result of a query, how would you indicate that in your formula?
Here is what I have so far, which is in a Formula URL Field, that pulls the correct query on an ask the user report. The report has the format set to CSV - so it downloads automatically.
URLRoot() & "db/" & [_DBID_LINE_ITEMS] & "?a=q&qid=19&nv=1&v0=" & [Record ID#]
I'd like to incorporate your updating of the naming convention on that queried report, but not sure how to string it together. Any advise on that? thanks so much!
Here is what I have so far, which is in a Formula URL Field, that pulls the correct query on an ask the user report. The report has the format set to CSV - so it downloads automatically.
URLRoot() & "db/" & [_DBID_LINE_ITEMS] & "?a=q&qid=19&nv=1&v0=" & [Record ID#]
I'd like to incorporate your updating of the naming convention on that queried report, but not sure how to string it together. Any advise on that? thanks so much!