5 Replies Latest reply on Jan 22, 2010 9:30 AM by philmodjunk

    Storing Copies of Documents



      Storing Copies of Documents


      I have a table of customers and a table of enquiries linked by the customer ID. There can be many enquiries per customer. Documents are issued to customers from data contained in the enquiry records. There can be many documents per enquiry and as data is changed in an enquiry record a new document will be issued. (That is each enquiry will be a developing item rather than an immediately completed event) I need to store a copy of every document that is issued. 

      I am not sure whether it is best to have a separate layout for each document or a separate table for documents. But I am particularly stuck with how to save the document copies so that they can accessed by Enquiy ID and document name at a later date.


      My Filemaker basics are reasonable but this is a bit beyond me.


      Could anyone please suggest what  might be the most sensible approach?

        • 1. Re: Storing Copies of Documents
             You should have a table that stores each doc in a container field ( or reference ) in its own related record.
          • 2. Re: Storing Copies of Documents

            It can be quite complex to build a true "versions" system for "enquiries" (where you do not need to duplicate items which are not changed, and can see them all within the database, from the "current" version). I would not recommend that method for a beginner.



            Method A: create each a enquiry as a separate entity record, and use an "original" ID field to tie them together. This stores each within the database. But it can be a bit of a pain to create each, if there are multiple lines to duplicate, as you have to duplicate all each time; and it is a little more difficult to see together (but OK).


            1. "ID original" field, which is populated via auto-enter (for the 1st one, to the real Enquiry serial ID), then written via script to the original ID when creating any later ones.


            2. Self-relationship between this field. This will allow you to quickly isolate and gather all versions together, show them in a portal on each, etc..



            Method B: Create another file, and store a PDF of each changed Enquiry, instead of creating new ones. 


            It would be like printing the enquiry for each change (which you should likely also do, computers being what they are). This is fairly easy to script. You could either embed each PDF (easiest) or store them in external folder(s). This is the simplest method from a "FileMaker work involved" perspective.


            It is not as easy to see the difference in prices, unless you also store the total with each one, as a number field; which is a good idea). It also creates a huge file size (unless you store the files elsewhere, in which case it does not need to be a separate file).  

            • 3. Re: Storing Copies of Documents

              Thanks mr_vodka. That was an approach I thought would work.


              Presumably I have to save a pdf of the document to the container field. I assume it would also need the Enquiry ID present to maintain the relationship? So table would have Document ID, Enquiry ID, and Document Copy (container) is that correct?


              I had intended using a button with a script to print and store.


              Could you give me an idea of the sort of script required for the storing and inserting Enquiry ID into Document table. That is where I am struggling.

              • 4. Re: Storing Copies of Documents

                I've spent more time looking through the threads and experimenting and have come up with the following scripted solution:



                Print [ Restore; No dialog ]Copy [ Select; Enquiry::Enquiry ID ]

                Set Variable [ $$DocumentA; Value:Enquiry::Full Document Name & ".pdf" ]

                Save Records as PDF [ Restore; No dialog; “$$DocumentA”; Current record ]

                Go to Layout [ “Document” (Document) ]

                Enter Browse Mode[]

                New Record/RequestPaste [ Select; Document::Enquiry ID ]

                Insert File [ Reference; Document::Text Store; “$$DocumentA” ]

                Go to Layout [ “Enquiry” (Enquiry) ]

                Go to Related Record [ From table: “Enquiry”; Using layout: “Enquiry” (Enquiry) ]



                It does everything I wanted.


                Can anyone see any problems with this or any improvements please?

                • 5. Re: Storing Copies of Documents
                     In your document table, you could also log additional information such as the current document version and revision date if that's useful information to track for reporting purposes.