Inforce Reference & File Type
1. Is there a way to enforce that a container only accepts a reference?
2. Is there a way to enforce that a container only accepts a file of type (e.g. filename.pdf)
This is easy to do with a script in FileMaker 12. Is that the version you have? If so, please see the screen shot shown below. If you want to use one of the other Insert methods such as insert PDF to insert into an interactive container field, your script can first insert the file with insert file and these options, then use the file path inside the container field to re-insert it as a "by reference" PDF.
If you have an older version, you can still enforce this after the fact. You can't keep them from inserting with the wrong options, but a script can detect the wrong file type and/or the wrong insertion option and reject the insert while displaying an error message.
I will use this way (the picture) I have FileMaker 12 Advanced.
Is there a way to do this if the file is dragged to the container? I wan the dragging option but I don't want the file inserted in my database only referenced.
Drag and drop always embeds a copy of the file into the container.
What might work for you is to use the OnObjectModify trigger on the field to perform a script. The script can use export field contents to export a copy of the file to a specified location and then re-inserts the file from that location with the "by reference" option specified.
Will it remove the embedded version after it does all this?
Since it can re-insert the file into the same container field of the same record, yes. The key is in correctly using a $Path variable to first export the file to a specified location and then again to insert it from that location. You use the same variable with the same file path text for both the export and the insert.
Set Field can also be used to clear the container field. In some versions of this method, the user drags and drops into a global container field and then the script creates a new record and inserts the reference to the exported file into a container field in the new record.
All of this inserted and then removed data does it make the database messy or create maintenance issues?
I see no reason why it should.
It's just moving data in and out of a single field or two fields if you use the global field option. (And over a network, global fields do not retain data entered by a client session once the file is closed on that client machine.)
Retrieving data ...