11 Replies Latest reply on Apr 21, 2012 2:24 PM by artgarcia

    Adding/Inserting Multiple Pictures using Inventory Template

    jeffw

      Title

      Adding/Inserting Multiple Pictures using Inventory Template

      Post

      Hello,

      I've just installed FM11 and using the Inventory Starter Solution template. I'm having a heck of a time trying to figure out how to add multiple pictures in one record. I've scoured the forum threads and haven't been able to figure how to do it. I understand that you can only have one picture per container, but I'm curious if there are ways around this limitation without altering the look/feel of the default template. I'm very green to using a database app, but FM is the only user-friendly option that has a template that met my needs perfectly...'til I ran into this challenge.

      Thanks for in advance!

      /Jeff

        • 1. Re: Adding/Inserting Multiple Pictures using Inventory Template
          bumper

          Do you know how to create a new table and relationships? 

           

          You first need to create a new table in Manage>Databases>Tables. Call it images. 

          Go to Fields pane, create an ID field, k_ID_Image, and a kf_ID_Record, both number fields, and a container called Pictures. You can add any of the creation. modification, or other fields you might need/want to add. Check out the k_ID_Record field in the Inventory table for how to make it an auto-create serial number field. The kf, which stands for key field foreign, with be auto populated with the number from the soon to be related k_ID_Record and is the basis of a relationship.

          Then in the Relationship pane connect the k_ID_Record to the kf_ID_Images field by selecting ID from Inventory and dragging it to connect with the kf_ID_Record. Then on the Images side check allow creation of new records.

          Back on the Record Detail layout replace the Picture field from Inventory with a portal from the new relationship, include a scroll bar and then put the new Picture field in that portal. In the Inspector>Position pane name the portal object. 

          Last step change the Insert Picture script to include:

          Go to Object (name you used in inspector)

          Go to Portal Row (Last)

          and change the Go to Field to the new field in your images table. Images::Picture.

           

          The last step is to transfer any existing pictures from the Inventory table to your new table and finally deleted the picture field in Inventory.

          This will allow as many related pictures as you want for each Inventory record. 

           

          This may sound complicated, but first, work on a back up, and take it one step at a time. Any questions, just shout.

          • 2. Re: Adding/Inserting Multiple Pictures using Inventory Template
            jeffw

            Thanks for the response, Bumper! I'd like to confirm/verify a few things with some questions:

            1) Created a new Table called Images with 3 fields: k_ID_Image and kf_ID_Record (Number Type) and a Pictures Container.

            2) Created a relationship from k_ID_Record (from Inventory) to k_ID_Image (Images).

            3) In the Record Detail Layout, I deleted the existing Picture field and selected Insert a Portal. From the "Show related records from:" I chose Images from the drop-down menu.

            -Do I select the Show vertical scroll bar checkbox? The reason why I ask is because the subsequent choices has the Include Vertical Scroll Bar grayed out.

            -There is also a Format section w/ Initial row and Number of rows (1 and 7). Those are the default values and I'm uncertain what it does as it creates a gray box in the layout that shows: "Images [1..7+]"

            -Also in the Add Fields to Portal section, I assume I just select the Pictures fields and not select k_ID_Image and kf_ID_Record?

            I attached a screenshot to better help explain what I just typed.

            Thanks again for your help and patient!

            • 3. Re: Adding/Inserting Multiple Pictures using Inventory Template
              bumper

              Couple of little glitches here:

              1) Created a new Table called Images with 3 fields: k_ID_Image and kf_ID_Record (Number Type) and a Pictures Container.

              2) Created a relationship from k_ID_Record (from Inventory) to k_ID_Image (Images).

               Instead make the relationship from k_ID_Record in the Inventory table to the kf_ID_Record in the Images table.

              The primary key in Inventory goes to the foreign key in Images, when you create a new record in Images from Inventory FM will put the Record ID number into the kf_ID_Record field. Just remember to check the "Allow creation of records in this table via this relationship."

              3) In the Record Detail Layout, I deleted the existing Picture field and selected Insert a Portal. From the "Show related records from:" I chose Images from the drop-down menu.

              -Do I select the Show vertical scroll bar checkbox? Yes The reason why I ask is because the subsequent choices has the Include Vertical Scroll Bar grayed out.

              -There is also a Format section w/ Initial row and Number of rows (1 and 7). Select 1, if and when you have multiple Image records for that Inventory record you will use the scroll bar to move between them. Those are the default values and I'm uncertain what it does as it creates a gray box in the layout that shows: "Images [1..7+]" This is the portal, you just don't need all those extra rows. If you double click on it in Layout mode you will get the dialog box back.

              -Also in the Add Fields to Portal section, I assume I just select the Pictures fields and not select k_ID_Image and kf_ID_Record? Yes and the picture field has to within the boundaries of the portal. You will probably have to increase the size of the portal and/or decrease the size of the Picture field. When you place the Picture field make sure it is from the relationship. In layout mode you will see a double colon in front of the field name, ie::Picture.

              I attached a screenshot to better help explain what I just typed. Your field is larger than the portal, resize the portal and field until the latter fits into the former, feel free to delete the portal and field from your first effort and start over, these are just objects and their deletion will not affect the underlying schema. That's a one size fits all word to describe tables, fields and relationships.

              Remember to work on a copy of your original file, that way if things go North, you can just trash it, make another copy and start all over.

              Thanks again for your help and patient! Not a problem I haven't lost a patient in quite a while. 

              • 4. Re: Adding/Inserting Multiple Pictures using Inventory Template
                jeffw

                I guess I can be a patient (for somebody) as this is making me mental! haha and your _patience_ is obviously much appreciated.

                I followed your instructions, but it's still only displaying one picture at a time and any additional photo inserted will overwrite the previous one. The Inspector panel is still showing the vertical scroll bar being grayed out and unchecked even though I checked it in the Portal created screen.

                Just to recap the adjustments per your suggested fixes:

                1) Created a relationship with k_ID_Record (Inventory) to kf_ID_Record (Images). Checked Allow creation of records in this table via this relationship in the Images Table area. (Screen shot attached)

                2. In Layout mode, I create the picture field and portal the same size and overlaid it on top of each other. I used the original dimensions from the Picture field. (Screen shot attached)

                3) Created/edited the Picture script. (Screen shot attached)

                **I tried deleting the Pictures container field from the inventory table, but that also didn't work and put it back in. Does it matter?

                Based on my description and screen shots, am I missing anything?

                Thanks again!

                • 5. Re: Adding/Inserting Multiple Pictures using Inventory Template
                  jeffw

                  For some reason I can't post multiple pics, but this is the screen shot of the Relationships.

                   

                  • 6. Re: Adding/Inserting Multiple Pictures using Inventory Template
                    jeffw

                    Screen shot of the Picture script

                    • 7. Re: Adding/Inserting Multiple Pictures using Inventory Template
                      philmodjunk

                      Take a look at the layout that you posted a screen shot of.

                      It has a field from the related images table, but does not have a portal to the images table.

                      If you add a portal to images with a scroll bar so that you can scroll through your images and put your container field inside the portal, you will be able to see and add images. If "allow creation of images via this relationship is enabled for Images in this relationship, you can scroll to the bottom of your portal and click the button to run your script to insert a picture and it will add it instead of overwriting an existing picture in the container field.

                      • 8. Re: Adding/Inserting Multiple Pictures using Inventory Template
                        jeffw

                        Hello, Phil.

                        I'm not sure I understand what it means that I don't a "portal" to the Images table. The step I took to create this was:

                        Insert --> Portal to bring up the Portal Setup. From there I selected Images from the drop down menu where it says: Show related records from. Also in that Setup box, I checked off Show vertical scroll bar. After clicking okay, it brings me to a Add Fields to Portal box where I selected Pictures and moved it over to the Included fields. That was what was created from the screen shot I posted.

                        Thanks,

                        /Jeff

                        • 9. Re: Adding/Inserting Multiple Pictures using Inventory Template
                          bumper

                          First your script, move go to object to the second line, then move got to portal row to third and insert picture last. FMP sometimes loses it focus and the go to object will get it to the right place and the last portal row will give you a blank row to create a new record. The order of scripts is very important as FMP runs them from top to bottom and you get strange results when they are out of order.

                          Now the portal, two things, the Picture field has to be contained within the inner borders of the portal, normally when you let FMP put the field in the portal for you it will do this but the field is usually too small. Next time leave it that way until you can see that everything is working and then you can enlarge the field to fit inside the portal. Second the field has to be in front of the portal, again this is the usual when a field is created, but strange things can happen so again, create a new portal, go with the scroll bar, put a field in it and then go to browse and test it. If if works now then you can adjust the size of the field to the size you want it.

                          If that fails send me your email address to my profile (click on my name) and I'll send you a working copy.

                          • 10. Re: Adding/Inserting Multiple Pictures using Inventory Template
                            krancmm_1

                            Just to add to Bumper's comments...

                            Delete the portal and picture container and start again:

                            1.  Make a portal, from Images (your relationship looks fine), with show vertical scroll bar, AND under the format section, Initial Row 1, Number of Rows 1 (you really don't need multiple portal rows.)

                            2.  Don't add any field just yet.

                            3.  The portal will look very narrow with just 1 row.  Resize the portal so that it's the same pixel height, but 12 pixels wider than your picture (the 12 pixels is where the vertical scroll bar will be on the right.  If the picture is 210 wide by 200 high, make the portal 222 wide by 200 high.  Also make sure in the Appearance Tab of the Inspector that lines are at least highlight or 1 point and a dark color.

                            4.  After you have the portal exactly where you want it, add the field Images::Pictures.  Line up the top and left sides of the picture with the portal top and left edges.  You should then have the picture covering all the portal EXCEPT for the vertical scroll bar at the right.  (BTW, your screenshot of the Inspector is showing the data from the picture field, not the portal - that's a different scroll bar, like what you see in the description or notes fields, and won't apply to a picture).

                            5.  Just to be sure, click the picture field only and menu|arrange|bring to front.

                            6.  This script worked when I tested it:

                            Set Error Capture [On]

                            Go To Portal Row [Select; Last]

                            Go to Field [Images::Pictures]

                            Insert Picture

                            Hope it works for you; I've had to do a lot of multiple photos and it does take some playing around to get it right.

                            Monica

                             

                             

                            • 11. Re: Adding/Inserting Multiple Pictures using Inventory Template
                              artgarcia

                              Hi Jeff! I have the same problem, Does these contribution makes the trick? Please let me know to put in practice myself!