Use the container field.
You set up a related table of records--one container field to each record for storing your files. Using a portal you can create as many related records to store documents (or references to documents) as you need. That's why I also suggested you research "portals" as a portal is the simplest way to manage these multiple related records in order to store and access your files.
I tried that before but the Portal din't Stay in the layout.
As you seggested I'm going to set up a table of records --one container field to each record for storing your files. But first i need to know how to make this.
I will try to create that table os records.. and then maybe i can create the portal in the layout
You need a related table before you can add a portal to your layout.
Open Manage | Database | tables and add a new table named Files.
Click on the fields tab and define at least these two fields in your database:
_fk_InventoryID (number field)
FileContainer (container field)
Select your Inventory table and give it an auto-entered serial number field if you have not already defined such a field. Let's name it __pk_InventoryID. Click the options button to bring up the field options in order to set it up as an auto-entered serial number. This setting enters a unique serial number into this field each time a new record is created. If you already have records in Inventory, their __pk_InventoryID fields will be blank until you give them serial numbers. If this is the case, let me know and I'll show you how to use Replace Field Contents to load the field with serial numbers for your existing inventory records.
Now click on the relationships tab and drag from __pk_InventoryID to _fk_InventoryID to link the two tables in a relationship based on these two fields. DoubleClick the relationship line to open up a dialog box where you can click the "allow creation of records via this relationship" check box for the Files table. This option makes it easy to add new records in the portal we are about to add to your inventory layout.
Click Ok to leave Manage | database. Enter layout mode. Now you can use the portal tool to add a portal to your layout. You can select the scroll bar option so that you can scroll through multiple records in your portal. Add the FileContainer field to yoru portal. You do not have to add _fk_InventoryID but you can add it if you want to see what happens in this field automatically each time you add a new record in the portal. After you dismiss the portal setup dialog box, you can resize the portal row to make it taller by clicking it and draging the selection handles if you need to make the FileContainer field larger. You may need to use portal setup (double click the portal while in layout mode to open up this dialog) to reduce the number of rows in used in your portal whenever you increase the height of the portal row.
Now enter browse mode and right click the FileContainer field or single click it and select an option from the Insert menu. You can insert files or pictures and you can insert either a copy of the file or a reference to the file's current location. If you insert a picture, you can see the image displayed in the container field.
Thanks a lot,
i'm trying it now!!
It worked perfectly, thanks a lot!!
However i would like that when i click in the file icon listed in the portal, that I could open that file without saving it again in order to visualize it.
Is this possible?
It can be done, but the details depend on the method used to insert the file. If you use the Insert File method and select the "store a reference" option when inserting the file, you can open the inserted file by double clicking the container field.
If you used insert picture or did not choose to use "store a reference", you'll need to use export field contents. (Export field contents will also open files inserted by reference.) You can set up your container field as a button that performs a script to export the field contents to the temporary items folder so that you do not clutter up your computer with extra copies of your files.
OK it means that:
If I select "store as reference", the file remains in it's original place, and when we click over its name in the portal list it will open from it's original place.
If I don't select "store as reference" the file is saved as a copy from it´s original place to my Filemaker database, and I can only open it if I choose "Export field contents".
How can I set a button in the container field to perform a script to export the field content to a temporary items folder?
(i m using MAC)
You would create a script like this:
Set Variable [$Path ; "File:" & Get ( TemporaryPath ) & GetAsText ( YourTable::YourContainerField ) ]
Export Field Contents [ YourTable::YourContainerField ; “$Path” ; automatically Open ]
GetAsText ( YourTable::YourContainerField ) returns the file name of the file inserted into the field (If "store a reference" is not specified) So you compute the file path and name and store it in $Path and then use it in Export Field Contents to control where the file is created and what it is named.
I'm trying but is not working,
I'm not doing it right for sure:
1st - I open the >> "button setting" over the container field in the portal (layout mode)
2 - I choose >> "set variable" >> "speciffy"
3 - 3 fields: name?? ; value/specify ; repetition 1/specify
4 - I copied the script to value/specify like this:
Set Variable [$Path ; "File:" & Get ( TemporaryPath ) & GetAsText ( Files::FikeContainer ) ]
Export Field Contents [ Files::FikeContainer ; “$Path” ; automatically Open ]
then I got the window report: the specified table cannot be found
Should I create a temporary folder? how?
I believe that the spript is no oK what should I change?
thanks for your patience
Your computer comes with a temporary items folder. Get (TemporaryPath) will return the path to it that's correct for your computer.
"specified table cannot be found" indicates that you entered the name of a table in your expression that does nto exist. This means that you made an error in creating the script--which you have.
You can't copy the above text into the "value window"
To create a script, open manage | Scripts and create the script there. Each of the two lines shown would be added to a script by finding the script step on the left hand side of the list of script steps in the script editor and double clicking it. After adding the script step, you click the specify buttons for that step and fill in/select the details.
Once you have created a script, you can use button setup with your container field to select the perform script option in order to select this newly created script as the script to be performed when the container field is clicked.
Thanks for the new post
I think it worked fine, but now the options to insert files in the containers are no longer available (only the chance of copy).
The only way for me to insert or delete new files is to stop the script again.
is the script correct?
Your script looks correct, but now clicking on the field to open the file interfers with inserting a file into it. You could add a button next to the container field that uses insert file to insert a file into the container, but maybe it would make more sense to add a button to your layout next to your container field and set it up to open the file instead of by clicking the field.
Yes it makes more sense adding a button to open the file, this way I think the option of "cut" stays available, so its possible to delete the file from the list in the portal.
But where exactly is the button placed?
inside the portal aside to the container window?
How can i do it?, and set the button with the function to open the file next to him?
In layout mode, select your field and choose "ungroup". This will remove the button setup on that field so that you can once again click on the field and insert files into it.
Use the button tool to place a button inside the portal row, next to the container field. You may need to resize the portal row to make room for the button. Use button setup to have this button perform your script to view the file. The script should not need to be changed for this to work.