1 2 Previous Next 25 Replies Latest reply on Jan 31, 2014 7:51 AM by Vicky

    Checklist and Containers

    Vicky

      Title

      Checklist and Containers

      Post

           Hi everyone,

           I am using a trial version of Filemaker 13. I have two tables, one is icons which contains pkIconID(serial num), iconName (text), iconPicture (container field), and a checkbox using a value list with the custom value of 1.  The other table is model which contains pkModelID(serial num) and modelName(text).

           Each model needs to have a checklist that includes all the icons.  When an icon or icons are selected by clicking the checkbox next to it, the selected icons' name and picture will be used to create a "label" (probably will be a pdf) for the model.  For example:

           Model is a computer mouse. if I select the icons bluetooth and usb, a small label will be created that will have a picture of bluetooth and usb and the words bluetooth and usb next to the respective picture. 

           I don't know how I should create the relationship between icons and model.  I have tried to use a cartesian relationship, but when I clicked an icon for one model, the rest of the models also have that same icon. 

           I also don't know how to go about creating the "label." I don't know how to get only the selected icons to show up on another layout.

           Should I be trying to use a cartesian relationship or should I try something else?

        • 1. Re: Checklist and Containers
          philmodjunk

               What you have is a many to many relationship. Any given record in Model can link to any number of records in icons. (Your mouse needs blue tooth and USB.) But any given icon can be linked to many different models as well. (You have 2 Mice and 4 external drives that need the USB icon...)

               Start with these relationships:

               Model-----<Model_Icon>-----Icons

               Model::pkModelID = Model_Icon::fkModelID
               Icons::pkIconID = Model_Icon::fkIconID

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

               You can place a portal to Model_Icon on the Model layout to list and select a Icons record for each given Model record. Fields from Icons (such as the container field) can be included in the Portal to show additional info about each selected Icons record and the fkIconID field can be set up with a value list for selecting Icons records by their ID field.

               And you won't need any check box field as it has been replaced by records in the Model_Icon table. But you can produce what looks and acts like a check box format if you want with scripting and conditional formatting.

               The following many to many demo file includes an example of such a layout design: https://www.dropbox.com/s/oyir7cs0yxmbn6i/ManyToManywDemoWExtras.fp7

               Users with FileMaker 12 or later can open this file from the File menu to get a copy converted to the newer .fmp12 file format.

          • 2. Re: Checklist and Containers
            Vicky

                 Your demo file is very helpful and the checkboxes layout seems to be exactly what I was looking for! How did you make the checkboxes though? I tried to make them the same way you did, but it can't be toggled. I think the only thing I did differently was that because I did not have a diminishing value list layout, I just made it go to the join layout and made the fields in set field from join too.  Is that why it does not work like yours, or is it something else that I have missed?  Is there a way to get it to work without the diminishing value list layout?

            • 3. Re: Checklist and Containers
              philmodjunk

                   The script looks correctly written. IF there's an error in it, I'm not spotting it.

                   Did you set up the Rectangle object and layout text as a button so that clicking it performs the script?

                   Did you add a conditional format expression to selectively hide/show the "x" character in each row of the portal?

                   Do you have FileMaker Advanced? If so, you should enable the script debugger and data viewer, then try clicking to perform this script so that you can step through the script and watch the values in the fields and variables change with each step to see if you can sport where this is going wrong.

              • 4. Re: Checklist and Containers
                Vicky

                     I did forget to make it a button and use conditional formatting.  I managed to make it a button, but the conditional formatting part for the x is still confusing me. I got it so that it can change colors. How do you set it up so that the x disappears/ reappears when clicked? 

                • 5. Re: Checklist and Containers
                  philmodjunk

                       In the conditional formatting dialog, click the "more formatting..." button and specify that the font size change to a very large size. When text is a single row in the 10-12 point font size, changing it to 120+ points is enough to make the text disappear from the text object.

                  • 6. Re: Checklist and Containers
                    Vicky

                         Thank you! It works now :)

                    • 7. Re: Checklist and Containers
                      Vicky

                           Hi PhilModJunk,

                           I tried to remake the scripts and layout in my main file because eventually I would like to work in a popover box, however I have come across a weird problem.  The field names, tables, relationships, scripts, conditional formatting, layouts are all the same, but when I click on the button the x does not reappear and the script does not delete, it only creates new records.

                           I tried to figure out what the problem was but I'm really stumped.  Is it the conditional formatting?

                      • 8. Re: Checklist and Containers
                        philmodjunk

                             With FileMaker 13, we can now use the "Hide When" setting in the inspector to make items appear and disappear on our layouts.

                             Where does the pop over come in for what you are setting up? WHere are you placing that button and what are you putting in the popover frame?

                        • 9. Re: Checklist and Containers
                          Vicky

                               The pop over is going to be on the model layout with the Icons and IconsAll portals and a button to print icons. If people click on the icons button to open the pop over, they will be able to see which model has bluetooth, usb, etc, and can change it by clicking the x if they want.

                                I noticed that it wasn't working in the pop over so I decided to try it out in a new layout in the actual file people were going to use.  The scripts and conditional formatting that were working in a sample filemaker file was not working in the layout.  The only difference between the sample file and the actual file was that the sample file only had the five table occurrences that you see in the relational graph.

                               Actually I should say it works but it does not delete, the script just continues to add records in the join table.  I still haven't figured out how to get the delete part to work.

                          • 10. Re: Checklist and Containers
                            philmodjunk

                                 The Popover should work, but if you place a popover  button inside the portal and use it to try and show a portal, it won't work as this appears to violate the "can't have a portal inside a portal" rule.

                                 If you have FileMaker Advanced, you could enable the script debugger and then test this script's ability to add/delete records to see where this goes wrong.

                                 Best guess at this point is that your script is losing the portal row focus before capturing the needed values from the clicked portal row.

                            • 11. Re: Checklist and Containers
                              Vicky

                                   Oh, I am putting the portals inside the popover not the other way around.  It doesn't work if I do that?  I don't mind just making a button to go to another layout if it doesn't work.  Right now I am testing it out in another layout without the popover but the conditional formatting and the delete part of the script is not working as it should.

                                   I found a filemaker 12 advance on my work computer and tried the script debugger.  

                                    

                              • 12. Re: Checklist and Containers
                                philmodjunk

                                     You can't put a portal into a popover frame if the popover button is also in a portal row. When you try to do that, the portal object "falls through" the frame to end up on the layout behind the frame.

                                     An unamed button is any button that has not been given an object name. Most buttons are not named.

                                     If you click the second button from the left, you can execute the script one step at a time while watching the results produced by each step. If you click the x= button, you'll open a data viewer where you can watch the values of fields and variables change while you step through the script.

                                • 13. Re: Checklist and Containers
                                  Vicky

                                       Thank you Phil for explaining how to use the script debugger. The x= button was very useful!  I tried running the add/delete selected icon script and the set variables work. Right after the If statement, it skips all the steps from go to layout until the else. 

                                  • 14. Re: Checklist and Containers
                                    philmodjunk

                                         Which would indicate that the If step is not evaluating to False when you expect it to. That's typical of either a loss of portal row focus or a relationship that isn't working as expected.

                                         You can use the plus sign on the Watch tab and copy and paste the full expression into a "watch" expression. Once you have advanced the script in the debugger to that point, you can use that expression to see how it is evaluating. You can also isolate parts of the expression such as the list function or the filtervalues function to see how they are evaluating to see if that helps you zero in on what is keeping this from working.

                                    1 2 Previous Next