13 Replies Latest reply on May 23, 2014 12:37 PM by JoeLeMonnier

    How to :container field "slideshow" multiple images

    JoeLeMonnier

      Title

      How to :container field "slideshow" multiple images

      Post

           I've got a parent table with a portal to a child that contains a couple of text fields and a container with a photo.The container window sits to the side in my layout. Each record of the parent displays the multiple child rows in the portal but only the first row (record) of the container. I can scroll through the portal rows and open up their (child) record , but cannot  find a way to just show the pictures associated with that portal row in the container portal while remaining in the parent layout.

           I'm looking for something simple with a button that advances the images.

           I've tried as a single portal with all fields and as two separate portals with text in one and just the contain field in the other but cannot make the container show anything more than the first record in the child.

            

           Any help is appreciated here. I am new at this, very new.

            

           Below is a sample. As you can see it displayed the first of two maps. I'd like to be able to display the other(s) using with buttons or a slideshow effect. 

            

            

            

      sample.jpg

        • 1. Re: How to :container field "slideshow" multiple images
          philmodjunk

               What you show looks like all is in one window instead of two separate windows. Is the container field on the right in a separate window and you have edited the screen shots to combine them, or do you show the container field on the same layout and in the same window as your other fields?

               And con you confirm that the list of locations on the left is really a portal? What is shown could be either a list view (with the map image in its own window) or a group of individual fields arranged in rows. I will assume with this answer that you do have a portal and that the container field is in it's own window, but if it is part of the same layout, the changes needed to make this work are small. Since your table and field names will be different, substitute your field and table names for mine.

               I will assume also, that this is your relationship:

               LayoutTable-----<MapImages

               LayoutTable::__pkLayoutTableID = MapImages::_fkLayoutTableID

               I will also assume that your second window to show the image is named "Map".

               Use the OnRecordLoad trigger to perform this script:

               set Variable [$$Rec ; value: 1 ]

               Add this new relationship:

               LayoutTable::_fkSelectedImage = MapImages|Selected::__pkImageID

               MapImages|Selected is my name for a second table occurrence of MapImages

               Set up your layout for the Map window to be based on LayoutTable, with your container field from MapImages::Selected.

               Then this script will advance your image to the image from the next related record shown in your portal:

               Set Variable [$$Rec ; Mod ( $$Rec ; Count ( MapImages::__pkImageID ) ) + 1 ]
               Set Field [LayoutTable::_fkSelectedImage ; GetNthRecord ( MapImages::__pkImageID ; $$Rec ) ]
               Commit Records
               Select Window ["Map" ]
               Refresh Window[]

               Note: The Set variable step will cycle the record shown from the first related record to the next, returning to the first record once it has reached the last related record.

               If you place the container field on the same layout so that you do not need two windows, the last two script steps can be omitted from this script.

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

          • 2. Re: How to :container field "slideshow" multiple images
            JoeLeMonnier

                 I think I misled you by calling it a "slideshow" Let's start anew.

                  

                 Below is the diagram of the relationships and a screenshot of the layout.

                 There are 2 portals to the same table but showing different fields. I want to be able to use the "next slide" button to advance through the portal rows.I can make it scroll down the left-hand portal (as shown, it has scrolled to the Ukraine map record).

                 But the right-hand portal has not changed and continues to show the first (Syria) map and not the second (Ukraine).

                 How do I make my script address the right-hand portal and change the image?

            • 3. Re: How to :container field "slideshow" multiple images
              philmodjunk

                   That's consistent with what I understood except that you only have one window here, not two.

                   Jobs-----<Maps

                   Jobs::JobID = Maps::JobID

                   I will also assume that your second window to show the image is named "Map".

                   Use the OnRecordLoad trigger to perform this script:

                   set Variable [$$Rec ; value: 1 ]

                   Add this new relationship:

                   Jobs::_fkSelectedImage = Maps|Selected::__pkImageID

                   Maps|Selected is my name for a second table occurrence of Maps

                   Set up your layout for the Map window to be based on LayoutTable, with your container field from Maps|Selected.

                   Then this script will advance your image to the image from the next related record shown in your portal:

                   Set Variable [$$Rec ; Mod ( $$Rec ; Count ( Map::MapID ) ) + 1 ]
                   Set Field [Jobs::_fkSelectedImage ; GetNthRecord ( Maps::__pkImageID ; $$Rec ) ]
                   Commit Records

              • 4. Re: How to :container field "slideshow" multiple images
                JoeLeMonnier

                     That was quick!!!  Thank you ! 

                     I was thinking of adding a new table with just the container and the mapID (note the relationship linkage extending from maps on the right) but I am way over my head in Filemaker. This is not at all intuitive to me- I draw maps which are very straightforward.- so I am very grateful that someone can be of help.

                     I'm still not sure I understand:

                      

                I'm not too familiar with triggers but can do javascript so I may figure it out

                     Jobs-----<Maps

                     Jobs::JobID = Maps::JobID

                  This is your restatement of the relationship

                     I will also assume that your second window to show the image is named "Map".

                 I've never named the second window. It's just a second portal (see below) Do I need to name the portals? How?

                     Use the OnRecordLoad trigger to perform this script:

                     set Variable [$$Rec ; value: 1 ]

                     Add this new relationship:

                     Jobs::_fkSelectedImage = Maps|Selected::__pkImageID

                     Maps|Selected is my name for a second table occurrence of Maps

                Lost me here: I think you want me to make a second occurrence in the relationships window but not an actual second copy, right?

                and you want me to rename one of the fields "maps|selected?

                     Set up your layout for the Map window to be based on LayoutTable, with your container field from Maps|Selected.

                     Then this script will advance your image to the image from the next related record shown in your portal:

                     Set Variable [$$Rec ; Mod ( $$Rec ; Count ( Map::MapID ) ) + 1 ]
                     Set Field [Jobs::_fkSelectedImage ; GetNthRecord ( Maps::__pkImageID ; $$Rec ) ]
                     Commit Records

                      

                      

                     Many many thanks again!! Call me if you need any help with Adobe Illustrator.

                • 5. Re: How to :container field "slideshow" multiple images
                  philmodjunk

                       What I am suggesting replaces portal 2 with a single container field from a new occurrence of the Maps table called Maps|Selected.

                       Please note that I have not told you to create a new table, but instead, a new occurrence of a table that you already have. Table occurrences are the "boxes" found in Manage | Database | Relationships such as what you have uploaded in your screen shots. To make a new occurrence of an existing table, select it and then click the duplicate button (two green plus signs). Then you can double click this new table occurrence to open a dialog where you can rename it if you want to name to be Maps|Selected as I have done in this example.

                       

                            I will also assume that your second window to show the image is named "Map".

                       

                   I've never named the second window. It's just a second portal (see below) Do I need to name the portals? How?

                       You don't have any such window. You only show one window in your example so please ignore this. When I copied, pasted and edited my original suggestion to include the actual names of your tables and fields, I failed to delete this sentence.

                       For more about table occurrences, see this thread: Tutorial: What are Table Occurrences?

                  • 6. Re: How to :container field "slideshow" multiple images
                    JoeLeMonnier

                         one more question:

                          

                    What I am suggesting replaces portal 2 with a single container field from a new occurrence of the Maps table called Maps|Selected.

                    portal 2 is now a single container field? Isn't it still a portal if it's reading from the maps table? Is it a part of the other portal? The base table here is "jobs" on which the 2 maps table portals sit. My guess is that it will be a portal to the  virtual "second" version of maps. Is that right?

                    I will try not to bug you for a while and will do my best to figure it all out and not bug you till I've learned something.

                    • 7. Re: How to :container field "slideshow" multiple images
                      philmodjunk

                           No. What I am suggesting is that you a) enter layout mode b) delete the portal and container field that you have now and c) use the field tool to add a new container field to the layout and specify that it be the container field from Maps|Selected instead of the container field from Maps.

                           Because this field will only show one image at a time, there is no need to be placed inside a portal. (You may not have realized that you can add fields from related tables directly to a layout without using a portal as long as you only need show data from a single related record.)

                           You are not bugging me. Answering "new user" questions is the one of the primary roles of this forum.

                      • 8. Re: How to :container field "slideshow" multiple images
                        JoeLeMonnier

                             (You may not have realized that you can add fields from related tables directly to a layout without using a portal as long as you only need show data from a single related record.)

                             MAY HAVE NOT REALIZED??  no it never crossed my mind but now it's inscribed in the corner of my eye so I'll wherever I gaze I can reflect on it.
                             Going to play with this tonight!
                              
                             These forums and folk like you have helped me learn many an application I paid for where the manual has failed . Another way of saying this is that  these software manufacturers should be paying you to do their job but you do it better anyway.
                        • 9. Re: How to :container field "slideshow" multiple images
                          JoeLeMonnier

                               I think I have everything setup right and the trigger set . The layout now has a single portal and the container field on the right holds the record from the new occurrence of the maps table. It seems liked I followed your script, but there is one line of the script I cannot figure out at all

                                

                            Set Variable [$$Rec ; Mod ( $$Rec ; Count ( Map::MapID ) ) + 1 ]
                            Set Field [Jobs::_fkSelectedImage ; GetNthRecord ( Maps::__pkImageID ; $$Rec ) ]
                            Commit Records

                               First Question: What is Map::MapID ? As you see below, I substituted.

                               Second Question: I made the 2 new fields ( Jobs::_fkSelectedImage & Maps::__pkImageID). I tried filling the later one with sequential serial #s and with blanks What do I fill it with?

                               Below is my relationship diagram and the script ;

                                

                                

                          • 10. Re: How to :container field "slideshow" multiple images
                            philmodjunk

                                 You are almost there.

                                 What you have in your script is correct. Count will count the number of related records for which the specified field is not empty. As long as you use a field that is never empty of data, such as the match field used in the relationships, this will work.

                                  __pkImageID field should be defined as an auto-entered serial number, but all your previously existing records will have this field empty only new records will automatically get the needed serial number. You'll need to use Replace Field Contents with the serial number option to update them with a unique serial number.

                                 Here are the specific steps.

                                 On a layout based on Maps, add your __pkImageID field to the layout (or to the View if it is set up for Table View).

                                 Show All Records

                                 Click in the Field and select Replace Field Contents from the Records menu.

                                 Use the Serial Number option to assign serial numbers to the records. Keep the option to update auto entry options selected so that this automatically update your next serial value setting on this field.

                            • 11. Re: How to :container field "slideshow" multiple images
                              JoeLeMonnier

                                   I learning this slowly, thanks!

                                   There are still some problems though I may be closer, but you'll be the judge.

                                   I had already filled the Maps::__pkImageID with serial #s.

                                   and I made one other big change in that I divided the script into 2 pieces: The first sets the variable to 1 and loads on opening the record. The second script has the rest: the lines where the value is set to the cycle of numbers, the field set and the record committed. I think you meant it this way and I misinterpreted it as a single script. See the new scripts below

                                   Here's where I think the problem is:

                                        1) I linked   Maps|Selected::__pkImageID>------<Jobs_fkSelected Image(note this looks like a many-many relationship)

                                        2) Filled Maps::__pkImageID with serial#s  

                                        3) I don't see see how those numbers  show up in the Maps|Selected  table or link to the Jobs table. And when I go to table view in the Maps table and bring the  Maps|Selected::__pkImageID field into the table layout, it's empty. When I try to fill it with serial #s it fills only the first few records (that correspond to the first jobID) with 1s.

                                   Am I right to think that I've made a mistake in the linkage and not in the script?

                                    

                              • 12. Re: How to :container field "slideshow" multiple images
                                philmodjunk

                                     Maps and Maps|Selected are two references to exactly the same table. if you hover the mouse over the arrow in the upper left corner of the table occurrence box for Maps and the one form Maps|Selected, the exact same name should pop up for both. And when you check this on the tables tab, you should see one table named Maps with two "occurrences" listed named Maps and Maps|Selected.

                                     But I can see from this image that __pkImageID should be update to define it ans an auto-entered serial number. When you do that, you should see the "crows feet" at the end connecting to __pkImageID disappear.

                                     

                                And when I go to table view in the Maps table and bring the  Maps|Selected::__pkImageID field into the table layout, it's empty.

                                     If the _fkSelectedImage record is empty for the related Jobs record, the Maps|Selected::__pkImageID SHOULD appear empty--not because there's an empty field, but because there is no field there at all, the relationship isn't matching to a record and thus nothing appears in the field. You should only use Replace field contents to update Maps::__pkImageID on this layout and that should be done only once to give every record in maps a unique ID.

                                     You asked "what does _fkSelectedImage contain?". If you look at the bottom script in your screen shot, you'll see that it gets whatever value your script assigns to it.

                                     And the OnRecordLoad script needs an additional script step.

                                     Set Variable [$$Rec ; 1 ]
                                     Set Field [Jobs::_fkSelectedImage ; GetNthRecord (Maps::__pkImageID ; $$Rec ) ]

                                     The second step is what enables a map image to appear in the container field from Maps|Selected.

                                     For more on table occurrences, see this thread: Tutorial: What are Table Occurrences?

                                • 13. Re: How to :container field "slideshow" multiple images
                                  JoeLeMonnier

                                       Yes! I finally got it to work !

                                       I've added a previous map button by tinkering with the script and adding an if clause to the modulus line for when it goes into negative numbers. Ialso added the feature of highlighting the portal row and displaying the map name under the container field.

                                        

                                        

                                        

                                       I could never have done this without you, thanks!!