Is it possible to delete all PDF file attachments on any given record without having to delete them one at a time?
I have many files with PDF attachments that I no longer need and want to go thru my database and delete those files. What’s the best way to do this?
I thought something like this might do the trick but it doesn’t:
delete(files(this));
Any ideas?
Thanks in advance.
11 replies
-
This is going to be possible soon.
Birger
-
yes please !
-
Hello Guys I found an alternative for this problem.
You have to duplicate the current record, which will transfer all the data except the attachments and image fields.
After that you have to delete your original record;
For instance your button code will look like:
let new := duplicate (this);
delete this;
openRecord(new)
-
P.S. Be careful with this one! It might not transfer everything!
-
NINOX - yes please
I have a table with over 10,000 records on it and i want to delete all the attachments on records on a set date that are over x years old to free up disk room but without resorting to deleting the records themselves.
A feature to delete them in bulk would really be great. Really don't fancy editing/deleting them one at a time when the time comes!!
-
This code maybe help you. It delete all files for one record :
let NumId := this.ID;
let i := 0;
let FileName := “”;
for f in files(this) do
FileName := text(f);
FileName := substr(FF, index(FF, “/”) + 1);
let lien := “https://api.ninoxdb.de/v1/teams/” + teamId() + “/databases/” + databaseId() + “/tables/” + tableId(“Sessions”) + “/records/” + NumId + “/files/” + FF;
alert(“Suppression du fichier :” + FileName);
let response := http(“DELETE”, lien, {
Authorization: “Bearer ***YOUR API NUMBER***”,
“Content-Type”: “application/json”
}, null);
void
end
-
Oops, on this line, you must put your table name (Sessions is my table“s name)
let lien := “https://api.ninoxdb.de/v1/teams/” + teamId() + “/databases/” + databaseId() + “/tables/” + tableId(”***YOUR TABLE NAME***“) + “/records/” + NumId + “/files/” + FF;
-
Oops, I made a mistake when I reformatted the code for you. This code works now.
let NumId := this.ID; <- PUT YOUR RECORD ID HERE
let i := 0;
let FileName := “”;
for f in files(this) do
FileName := text(f);
FileName := substr(FileName, index(FileName, “/”) + 1);
let lien := “https://api.ninoxdb.de/v1/teams/” + teamId() + “/databases/” + databaseId() + “/tables/” + tableId(“YOU TABKLE NAME”) + “/records/” + NumId + “/files/” + FileName;
alert(“Suppression du fichier :” + FileName);
let response := http(“DELETE”, lien, {
Authorization: “Bearer YOUR API CODE”,
“Content-Type”: “application/json”
}, null);
void
end -
Thanks.. I am having some issues getting the JS to work.. but will plug through it.
Content aside
- 1 yr agoLast active
- 11Replies
- 1445Views
-
3
Following