4 Replies Latest reply on Jun 29, 2011 9:52 AM by DavidRuggles

    Insert image in related table



      Insert image in related table


      I'm an old programmer, but new to filemaker (that can make things challenging Wink)

      Background: I started with the Inventory Starter Solution and the first thing I would like to do is have multiple images per inventory item.

      What I've done that doesn't work: I created a Photos table and related it to the Inventory table on Inventory::K_ID_Record I then changed the Insert Picture script:

      • Freeze Window
      • Go to Layout ["Photos" (Photos)] (In my research there appears to be no other way to change databases)
      • New Record/Request
      • Go to Field [Photos::item_key] (my related field)
      • Insert from Last Visited [Select; Inventory::k_ID_Record] (this is what doesn't work, I'm trying to get the k_ID_Record from the Inventory item I was on when I clicked "Insert Picture")
      • Go to Field [Photos::photo]
      • Insert Picture [] (this works fine)
      • Go to Layout [original layout]

      any pointers would be greatly appreciated! Thanks

        • 1. Re: Insert image in related table

          Try it this way:

          Set Variable [$ID ; Inventory::K_ID_Record]
          Go To Layout [Photos]
          New Record/Request
          Set Field [Photos::Item_Key ; $ID]

          BTW, Photos isn't a "database" it's a table. And you definitely need to use Go To Layout to change the "current table occurrence" during script execution. Each layout refers to a table occurrence in "show records from" in layout Setup... Each table occurrence is a "box" in Manage | Database |Relationships. Each such table occurrence has it's own, current record, found set and sort order for each FileMaker window currently open.

          For more on table occurrences, you can check out this tutorial on the concept: 

          Tutorial: What are Table Occurrences?

          • 2. Re: Insert image in related table

            Thanks for the quick reply. Sorry for using the wrong term. I've been doing MySQL and other SQL db development for years so I know the difference between a database and a table, but I started db development on an transactional database engine which really messed up my terminology and as you can see I still use the wrong terminology from time to time. sorry again for confusing the subject.

            The Manage | Database | Relationships layout is similiar to MS Access's (hope I don't get shot for saying that) Relationships and was pretty straight forward. The only thing I'm having any real problem with is getting my head wrapped around how to write and use the scripts.

            • 3. Re: Insert image in related table

              I agree that Manage | Database | Relationships is very similar to the relationships form in MS Access. It wouldn't suprise me if some day I found out that it was part of the "inspiration" for this feature. Just keep in mind that most parts of the FileMaker App refer to "table" when it really means "table occurrence". Understanding TO's and how the control the function of your database can really help you take your database design to the next level.

              • 4. Re: Insert image in related table

                Thanks for the pointers, parts of this are definite paradigm shifters.