6 Replies Latest reply on May 5, 2017 3:06 PM by jeff23

    Auto Update Pictures in Containers?

    jeff23

      Hi,

       

      I'm a total FM newbie...only hours old! I've succeeded in creating a form that auto populates the Personal info fields from another table (Subject Info).The auto populate function kicks in when I type the exact name referenced in this table into a new record. I'm using the Looked-up Value command to achieve this. The empty white container in the middle is a place for a photo. Unfortunately, I didn't include photos when I created the Subject Info table. Over 200 records later, I'm trying to force FM to re-auto populate the image container with the newly added photos in the Subject Info table. It only works with new records. How can I add these photos to the existing records?

       

      I'm using FM 14 Advanced.

       

      Many thanks!

        • 1. Re: Auto Update Pictures in Containers?
          psijmons

          Since you are really at the beginning, familiarize yourself with some basic concepts of a relational database. In the long run it will help you enormously and prevent some early design mistakes. Still, we all made them at some point and took the consequences. Each error makes you more experienced.

           

          In a relational database, try to have a single item entered in only one place, then display that field in other (table) layouts via a connection, usually via some ID that is primary key in one table and foreign ID key in the other table.

           

          Then ask yourself the question: is this a one-to-many relation, one-to-one, many-to-one or many-to-many.

          For example, a class may have several students and a student can participate in many classes.

          Just draw it to clarify your basic schema, then try to mimick that in the relation graph

           

          I see several fields in both tables that are the same. That should not be necessary.

          You do not have to "lookup" these fields, you can just display a field from a related record.

          The only field that is different in your 2 tables seems to be Footage. Is this really what you want?

           

          Now for the matter of your container photos: are they already in your subject table?, in that case you should be able to display them in the Personal Info layout. If you want the in the Personal table, create a script that loops over all records and use a set field command:

           

          GoToRecord (first)

          Loop

          Set Field [ Personal::Picture ; Subject::Picture ]

          GoToRecord (next, exit after last)

          End Loop

          • 2. Re: Auto Update Pictures in Containers?
            psijmons

            A good starting point of your learning curve is to start one of the simpler examples that are included in FMPA and dive into the details, see how other have solved things:

            script details

            relation diagram

            layout display tricks etc

            • 3. Re: Auto Update Pictures in Containers?
              philmodjunk

              I agree that this looks like a case where you should link to the correct picture rather than auto-enter it via looked up value. Ideally, this should be by an auto-generated ID such as a serial number or get ( UUID ). The reason for this is because names are not unique and because people change their names so you don't want to use the name to match to the photo.

               

              But in cases were you do need to force an update of a looked up value, there are two options that you can research in Help: Relookup (only works on fields with looked up value settings) and Replace Field Contents. Both can change every record in a table and cannot be undone, so you may want to experiment with these on a copy of your file when you are first learning how to use them.

              • 4. Re: Auto Update Pictures in Containers?
                jeff23

                Thank you so much! Yes, the photos are already in my Subject Table. They aren't populating the containers of past records, though, only new ones. 

                 

                As for that script, where do I put it?

                 

                I really appreciate you sharing your time and expertise with a newbie!

                • 5. Re: Auto Update Pictures in Containers?
                  philmodjunk

                  No script is needed. If your lookups are working, you have a valid relationship to the table of photos. So do this:

                   

                  On your subject info layout, enter layout mode. Drag and drop the field tool onto your layout to add a field. This opens the specify field dialog. From the drop down at the top of this dialog select your photos table occurrence. This should be the exact same name that you specified in your looked up value auto-enter field option. You should now see the fields from your photos table. Select the container field to add it to your layout. Size and position this field on your layout where you want to show the person's picture. This linked field from your photos table will now show the picture for every record in Subject Info that links to a record in the photos table. Should you later update one of these photos, it will update automatically on your subject Info layout.

                   

                  Remove the old field from your subject info table as you do not need it.

                  • 6. Re: Auto Update Pictures in Containers?
                    jeff23

                    Thanks SO much for your help. This did the trick!