4 Replies Latest reply on Oct 30, 2014 10:08 AM by philmodjunk

    Correlate container field (image) with portal row



      Correlate container field (image) with portal row


      My FM is set up with records in the Inventory layout. In the inventory layout there is a container field for a picture of the inventory item. In a different layout (ShopOrders) there is a portal that pulls the inventory items. I want the picture associated with the inventory item from portal to pop up on the ShopOrders page. It will show the proper image for the first row in the portal, but after that it will not change pictures. 

      So far I have something like:

      **On the Item field inside portal** OnObjectModify "Set Transaction Price"

      Set Transaction Price script:


      Set Variable $ItemID: Transactions::Item

      New Window

      Go to Layout Inventory

      Enter Find Mode

      Perform Find

      Set Variable [$image; image|container]

      close window

      set field [shoporders::container; $image]

      commit records

      Any suggestions on how to make it so after every entry the box will update itself with the current item?

        • 1. Re: Correlate container field (image) with portal row
          /files/2683c9ecf4/Screen_Shot_2014-10-28_at_2.29.02_PM_1.png 955x1016
          • 2. Re: Correlate container field (image) with portal row

            You shouldn't need a script to set the price for each item in the portal. A looked up value or auto-enter calculation can use a relationship to look up (copy over) the price from a products table of prices.

            The OnObjectEnter trigger can set a field in the layout's table that serves as a match field to a different occurrence of products and thus be used to display an image for what ever portal row is currently "active" in the portal.

            • 3. Re: Correlate container field (image) with portal row


              Thank you for that tip! I ended up putting the container field inside of the portal row and made that field a looked up value to the inventory layout with the original picture. I then made a new script that set variable to the item in the portal and the script goes to the inventory layout to copy the content of the container with the original image. The script then pastes the content in the container of the portal row. (I set this script to OnObjectEnter). This process seems to work.

              • 4. Re: Correlate container field (image) with portal row

                It may work, but it's pretty inefficient. Do you realize that what you described copies the same information twice? And you don't need to copy it at all?

                Say you have these typical relationships:


                Invoices::__pkInoviceID = LineItems::_fkInvoiceID
                Products::__pkProductID = LineItems::_fkProductID

                Your names may differ than mine but as long as the match fields function the same, it doesn't really matter for what I am about to describe.

                Make a new table occurrence of Products and link it to Invoices like this:

                Invoices::_fkSelectedProductID = Products|Selected::__pkProductID

                You can then add the container field from Products|Selected to your Invoices layout and this script can then make a specific product image appear in that container field:

                Set Field [Invoices::_fkSelectedProductID ; LineItems::_fkProductID ]

                You'd run that script whenever you select a new value in _fkProductID, when you click a button in the portal row or when you trip the OnObjectEnter trigger for the portal row by clicking or tabbing into any object in the portal row.

                Note that you can add a container field from products to the LineItems portal row and it will display the correct product image. there's no need for a look up field to copy the data over.

                For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained

                Caulkins Consulting, Home of Adventures In FileMaking