preSaveTempId
3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 21, 2011 (RSS)
By Perchpole - April 21, 2011
I've just been looking at the Uploads table when I discovered a column called preSaveTempId...
What is it for?
:o/
Perch
What is it for?
:o/
Perch
Re: [Perchpole] preSaveTempId
By Dave - April 21, 2011
Hi Perch,
It's a way of keeping track of uploads for records that haven't been created yet.
When you upload files CMSB stores the tablename, fieldname, and record number the file was uploaded for so it knows which record the upload "belongs" to.
But when you are creating a new record there is no record num yet because the record has never been saved. So when displaying the add record form but "before-save" (preSave) we create a temporary id code (TempId) of random characters that is associated with the new record
When you upload files to a new record it stores this preSaveTempId, and when you save the record for the first time it looks for files uploaded with that preSaveTempId and "adopts" them (blanking out the preSaveTempId field and setting the recordNum field).
And uploads that aren't adopted by a record within 24 hours and removed.
Hopefully that makes sense. Feel free to ask any other questions.
It's a way of keeping track of uploads for records that haven't been created yet.
When you upload files CMSB stores the tablename, fieldname, and record number the file was uploaded for so it knows which record the upload "belongs" to.
But when you are creating a new record there is no record num yet because the record has never been saved. So when displaying the add record form but "before-save" (preSave) we create a temporary id code (TempId) of random characters that is associated with the new record
When you upload files to a new record it stores this preSaveTempId, and when you save the record for the first time it looks for files uploaded with that preSaveTempId and "adopts" them (blanking out the preSaveTempId field and setting the recordNum field).
And uploads that aren't adopted by a record within 24 hours and removed.
Hopefully that makes sense. Feel free to ask any other questions.
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] preSaveTempId
By Perchpole - April 21, 2011
Ah. Thanks, Dave. That makes perfect sense.
I've been looking at ways to pull uploads into unrelated records - hence the interest.
I can't help feeling it might be useful to access the Upload table directly - as a separate/independent section. It could have it's own editor page which would list all the files that have been added.
You could upload all your files into it without first having to create a record. All you would need to do then is link to the files from your records as required.
I think this would be really handy for downloadable attachments like PDF files and the like - which you might want to link to thru various records.
That said, I'm very keen to see what you've done with the "Shared Asset Library" flagged up in the development plan.
Any idea when this one might appear?
:0)
Perch
I've been looking at ways to pull uploads into unrelated records - hence the interest.
I can't help feeling it might be useful to access the Upload table directly - as a separate/independent section. It could have it's own editor page which would list all the files that have been added.
You could upload all your files into it without first having to create a record. All you would need to do then is link to the files from your records as required.
I think this would be really handy for downloadable attachments like PDF files and the like - which you might want to link to thru various records.
That said, I'm very keen to see what you've done with the "Shared Asset Library" flagged up in the development plan.
Any idea when this one might appear?
:0)
Perch