Topic: Edit a Saved File

Hi all,
I have a FILE field on one of my forms.
I can SAVE, OPEN and DELETE the file. (my file is a Word file)
However when I open the file and EDIT it in Word and Save it, it looks like it worked but when I reopen my file the change is not there.
-
Can I edit a file that is saved in MVD?
-
Thanks, Frank

Re: Edit a Saved File

Have you saved the document into the database or just saved a link to a file in the database?

On a clear disk you can seek forever

Re: Edit a Saved File

I used TYPE = StoreFile

Re: Edit a Saved File

Use LinkFile, then use CopyTo to save the copy on your application folder
You can set CopyTo to blank if you only want to point on the current location of the file.

Post's attachments

Attachment icon sample_word_edit.zip 505.17 kb, 298 downloads since 2020-10-05 

brian

5 (edited by derek 2020-10-05 20:50:29)

Re: Edit a Saved File

Hi Frank, Hi Brian,
As Brian says, I would always go with 'linkfile' rather that 'storefile' otherwise you'll find that your database can quickly get pretty big.
Use 'copyto' in conjunction with 'linkfile' and you can set up a hierarchy of folders within your application where you want to store files that is discrete from your sqlite.db.
To answer your question about opening, editing and saving files, there are two basic approaches.
The first approach is simply to shell out to MSWord, Excel etc and do your work directly in the application.  This is pretty easy.
The second approach is to pull the file into MVD, edit it and then save it back out which isn't quite as straightforward, but can be done.
My preference is for the first option (and not just because it's simple - LOL!) but because you have a consistent approach no matter what type of file you are referencing (for example, in the attached example, there are .txt, .rtf, .pdf, .png, .jpg files - but it could be any file type) and it's exactly the same in all instances - click on the file name and it opens using its default program.
In the attachment, files can be accessed either through the tablegrid (Form1) by clicking in the appropriate cell or accessed on Form2 by clicking in the dbfile field on the file name.  There are many ways to do it but in this example, I use 3 folders within the application to store application forms, photos and references.
Hopefully it might give you some ideas how to move forward.
Derek.

Post's attachments

Attachment icon frank file edit and save.zip 807.72 kb, 335 downloads since 2020-10-05 

Re: Edit a Saved File

Brian, Derek,
I finally understand.  At first I tried using LinkFile without a CopyTo and I wasn't getting what I wanted.
-
I didn't follow the instructions from Brian...no wonder it wasn't working.
-
From my testing it looks like if I just put something in CopyTo, like Files-Contacts, it will automatically create that folder in my program directory. Pretty slick!
-
Then if my user wants to transfer the program to another computer, all of the saved files will go with him.
FYI, in my records program it's pretty important for folks to be able to save documents, So this will work perfectly.
-
Thank you gentlemen, you've saved me again smile