It's only one file to a container field.
I suggest setting up a table of related records for your files. Then you can use a portal for this and users can then attach a fully flexible number of files to a given record.
Your button's script can then create a new related record and insert a file into it. This also eliminates the need to check each field in turn to find one that's empty.
Thanks for your reply. That's a good idea that I never thought of. I'm a little uncertain about how that would be scripted, though. I tried a couple of different things but it didn't work. Could you be specific?
I should have mentioned that I'm placing that portal in a popover button. From what I understand this shouldn't be a problem.
The answer of philmfdjunk is correct. As relational database FM need a Table (Type: ID Customer,Name, Surname ... etc.) and another Table Documents (Type: ID Document, ID Customer, Container). So one Customer has many Documents and this table is in a portal row. I have only a problem in this same case: Server Win and clients WIN/MAC.
the Win clients put in container PDF documents as referred directory on server and open it in Acrobat directly with a double click; the Mac clients, else, can only export it to their own Apple. Why ??
If the create option is enabled for the relationship....
assign an object name to the portal using the inspector.
In your script:
Go to object ["objectnameofPortalHere"]
Go to Portal Row [ Last ]
Insert Field [specify container field in portal row here]
Note that this script will open your popover with the go to object step if it is not already open.
" I'm a little uncertain about how that would be scripted, though. I tried a couple of different things but it didn't work. Could you be specific?"
Conversely; how about YOU be specific?
Consider providing a copy of your script; or a simplified example file which illustrates what you have attempted.
It is very difficult to provide meaningful replies to "I tried something but it didn't work."
Sorry bruce but I didn't the things I try are of much help because I don't really know what I'm doing and will make obvious mistakes.
I tried your script phil and it opened the popover button box but no dialog box (for inserting the file) appeared.
So I also tried a couple variations of that. This is the first one:
Go to layout [documents" (documents)]
Go to portal row (first)
Insert File [Filters; Reference; Never Compress; documents::document container]
This unfortunately opened the portal in a whole new layout. The insert file dialog box appeared and I was able to insert a file but it didn't appear in the in the popover button portal when i returned to it.
So I did the same script with go to layout [original] added in the 3rd row. It did the same thing as before - it went to the portal but no dialog box.
"Sorry bruce but I didn't (think) the things I try are of much help because I don't really know what I'm doing and will make obvious mistakes."
Then it is hard to see how you expect this to work. It is understood that you are making mistakes. It is the particular and exact details of your mistakes that we need to see.
If you just keep saying "I tried something and it didn't work" then we cannot help you.
Please either attach your file; or create a simplified version of your file; and attach it.
Then somebody can actually help you.