Easily done, but I recommend that ProductID be a serial number instead of a file name like you've shown here--it's much too easy for duplicate names or data entry errors to really mess things up for you if you don't.
Put your images in a image table. Container fields are the field you use to store either images or file references to images. If you have a folder of images, you can use Import Records | Folder to import the entire folder of images into a fileMaker table in one operation.
Use this relationship:
LineItems::ProductID = ImageTable::ImageID
Then place the container field from ImageTable on yoru LineItems layout or inside your lineItems portal.
When you select or enter a productID in LineItems::ProductID, you'll see the image from the related ImageTable appear in the container field.
First of all, Thanks for all the help!
I have created a new database file named ImageTable with a single container field named Photographs; the images folder has been imported with no problem to the Photographs field.
In the original table (LineItems in your example), the relationship between LineItems::ProductID = ImageTable::Photographs was created by clicking File > Manage > Databse...
My question now is how to place the container field Photographs from the ImageTable into the LineItems table or layout?
Did I do this wrong? As you may have guessed, I am in dire need of basic database training...
once you have the relationship set up you should be able to insert the field on the layout and select ImageTable in the upper part of the Specify Field box, then Photographs as the field name.
Thank you Mark. The field Photographs has been added now, but I am getting a "<Index Missing>" remark as a result...
ImageID must be a stored, indexed field. This normally is not an issue unless the field is a calculation field that has either been set to unstored or that cannot be stored due to referring to a field in a related table.
Check the storage options for this field.
You need at least 3 fields in the image table, an ImageID (serial number for the images), ProductID (to relate the picture to the product in the line item table) and the Photographs container field.
Relationship should be Lineitems::ProductID => ImageTable::ProductID
Then on your Product layout, place the Photograph container field from the Image table and it will show the photograph that is related to that product.
Phil, if the container field that includes the pictures in the ImageTable is set to stored, it will warns that all the data will be lost. The only option available for this field in Storage is Global. Does another field need to be created then stored and indexed?
Mark, the name of the picture file is the item's serial number. In other words, the ProductID is equal to the picture file ID but without the extension ".jpg". Do I still need another field in the ImageTable.
I guess I need very basic information - all the help is very much appreciated from you both. Thanks again!
If the field has global storage enabled, you can only store one image in it, no matter how many records are present in your table.
Copy this image to the clipboard or export it using export field contents. Then change the storage options so that it is no longer a global field. Now you can re-insert or paste your image into the container field. (If you copy and paste here, you are storing a binary copy of the file instead of a reference to it.)
If that is always true, no you don't need another field.
It worked very well... thank you very much! One more question, the only way that it works as intended is if the file name with the extension ".jpg" is entered. Is there any way that the name of the file without the .jpg extension be entered in the ProductID field? My LineItems table is structured this way with more than 2,000 records.
I am assuming that a new field needs to be added to the ImageID Table that has the file name without the extension; then make the relationship with this new field. If this is correct, could you give me advise on how to achieve this? Thanks again!!
If you set up the script that inserts or opens the file to use a variable, say $$filename, you can set the variable to = Imagetable::PictureID & ".jpg"
Then use that variable in the open or insert picture step.