You should have a table that stores each doc in a container field ( or reference ) in its own related record.
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).
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.
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?
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.