14 Replies Latest reply on Sep 13, 2016 2:41 PM by fitch

    Stuck with buttons and scripts and I need help

    titomagrini

      I have just started using filemaker Pro 14 and I am stuck with buttons and scripts.

      I will start saying that I have created three tables artworks, exhibitions and I have added also a join table because it is a many to many relationship.

      The problem I am having i think is very simple for some people, I would like to have a button in the artwork layout named Assign Exhibition, which takes you to a list of exhibitions and you tick the appropriate exhibition and next to it there is a button named Assign, by clicking the Assign button, it takes you back to the portal in the artwork layout and magically see listed the exhibition that i had just selected.

      I would really appreciate your help.

      Thanks

        • 1. Re: Stuck with buttons and scripts and I need help
          coherentkris

          you should get the filemaker training series and work through it as this is definately FileMaker 101

          • 2. Re: Stuck with buttons and scripts and I need help
            David Moyer

            Hi,

            I think the script step you're looking for is Go To Related Record(s).

            I believe that Kris wants you to "learn to fish", which is, of course, a good thing.  So please look at:

            FileMaker Training Series | FileMaker

            • 3. Re: Stuck with buttons and scripts and I need help
              fitch

              You wouldn't necessarily go to related -- my reading of this is that you want to see a list of exhibitions that aren't yet related.

               

              So, starting from Artwork, your first script would look something like:

               

              Set Variable [ $artID ; yourArtworkIDField ]

              Go to layout [ join ]

              New Record

              Set Field [ yourArtworkJoinIDField ; $artID ]

              Go to layout [ Assign Exhibition ]

              Show All          // or you could script a Find for current Exhibitions or something

               

              OK, at this point you've created your join record and it has the art ID, and you're sitting on a list of Exhibitions. You don't need a checkbox, just a button that is on the body of the list (i.e., not in the header) with a script:

               

              Set Variable [ $exID ; yourExhibitIDField ]

              Go to layout [ join ]               // the record you just created will still be the current record

              Set Field [ yourExhibitJoinIDField ; $exID ]

              Go to layout [ Artwork ]        // the record you were on will still be the current record

              1 of 1 people found this helpful
              • 4. Re: Stuck with buttons and scripts and I need help
                philmodjunk

                You might be interested in the buttons set up to look like a set of check boxes with a scroll bar shown in:

                 

                Adventures in FileMaking #2 - Enhanced Value Selection

                 

                Clicking such a button can perform a script to create the join table record that Tom Fitch is describing, but the user just clicks "check boxes" in a portal.

                • 5. Re: Stuck with buttons and scripts and I need help
                  titomagrini

                  Not really knowing what Fitch's instructions meant, somehow it works but on the other hand I have created a new exhibition layout in list view and assigned the relevant exhibition from this layout exhibition list. It works now. Thanks to everybody for your help.

                  • 6. Re: Stuck with buttons and scripts and I need help
                    fitch

                    Happy to try and clarify anything that wasn't clear.

                    • 7. Re: Stuck with buttons and scripts and I need help
                      titomagrini

                      Fitch: I am very new to FMP, I am at that stage where I find the most simple explanations too difficult to understand. Most probably I will start a course on FMP very soon, I have signed up with Lynda but I prefer to work with a teacher.

                      Thanks for your help.

                      • 8. Re: Stuck with buttons and scripts and I need help
                        titomagrini

                        I would like to solve a different problem if all of you don't mind.

                         

                        As I mentioned, I have the artwork table, Exhibition Table and a join table and to get more complicated, I have added 2 new tables: Editions table (artworks sometimes exists in limited-editions of the same work) and Publications table (published articles associate with the the artwork).

                         

                        In the artwork layout I have added three tabs, exhibitions, editions and publications, each containing a portal, what i find annoying is the fact that when I view the current artwork record there could be more records associated with the artwork, for example there could be 1 publication 2 editions and 1 exhibition, which they are hidden away from the overlapping menu tabs.

                         

                        I would like to have within the artwork layout a field named probably “Found Record Count” that sums up - work of art + exhibition(s) + edition(s) + Publication(s) related to the current work of art.

                         

                        I guess I need a sort of calculation that sums up. I have been experimenting with Get (FoundCount) but it only counts the total numbers of artworks in the entire database, I would like the calculation to count only the current page I am viewing.

                         

                        Sorry for this long description and I hope to hear from you soon.

                        • 9. Re: Stuck with buttons and scripts and I need help
                          fitch

                          The calculation you need is Count. E.g.:

                           

                          Count(editions::id)

                           

                          Create this field in the artwork table, and it will count the number of editions related to each artwork record. Be sure to use a field that will never be empty such as the id field -- empty fields won't be counted.

                          • 10. Re: Stuck with buttons and scripts and I need help
                            titomagrini

                            Thanks T. Fitch.

                            The calculation worked.

                             

                            I feel really bad about asking too many questions but I guess the purpose of a forum is for asking help.

                             

                            Question:

                            I would like to create an Edit Button that allows me to switch fields in a layout from being un-editable to editable.

                            I don't want to delete information in fields by mistake. I Would like to add an Edit button to avoid accidents.

                             

                            I have looked through the forum and found a similar solution to my question.

                            uncheck browse mode in the field and then have a script attached to the 'Edit' button that commands Go to field/Enter browse mode. Thats fine and I have managed to do it but it is limited to just one field.

                             

                            I would like to be able to do the same with the entire layout, having all fields un-editable and clicking on the Edit button and they all become editable.

                             

                            Thanks for any suggestions.

                            • 11. Re: Stuck with buttons and scripts and I need help
                              beverly

                              I feel really bad about asking too many questions but I guess the purpose of a forum is for asking help.

                              feel free to jump in with answers once you learn them and someone else has the same questions.

                               

                              beverly

                              • 12. Re: Stuck with buttons and scripts and I need help
                                beverly

                                There are IDEAS on this forum for requesting greater control:

                                 

                                There may be suggestions for "now" on those threads. And these topics:

                                 

                                "Save Record and Prevent Changes to it"

                                "How to prevent a record from being unintentionally edited"

                                 

                                (and more...)

                                • 13. Re: Stuck with buttons and scripts and I need help
                                  fmpdude

                                  I totally agree with coherentkris.  Learn some stuff first. Otherwise, if you're like most newbies, you'll just bounce from one confusing database topic to the next since you never took the time to understand any of them.


                                  My suggestion: Take a step back and check out the Lynda.com filemaker training first. You can even get a free trial period there.

                                   

                                  FileMaker has SO much stuff in it, yet, if you know the basics, it's all pretty easy stuff the way it's implemented.

                                   

                                  People here on the forum will be all too happy to try to help you fix a particular issue and this may be the best forum I've ever seen. But, often the issue is just taking a step back and spending a week or two learning. We all had to do it once (and every database person I know never stops learning).

                                   

                                  FileMaker also encourages you to "jump in", possibly prematurely, as it seems easy (and it is after a learning ramp up).

                                   

                                  HOPE THIS HELPS.

                                  1 of 1 people found this helpful
                                  • 14. Re: Stuck with buttons and scripts and I need help
                                    fitch

                                    Ask as many questions as you like, it's fine. I would recommend that you start a new discussion when you have a different question. It will give you a better chance of getting responses, and will help future readers find topics when they might have a similar issue.

                                     

                                    As for controlling editing, there are many approaches. One of the simpler ones is to duplicate your layout, and on the view-only layout select all the fields and using the Inspector, un-check Field Entry > Browse Mode.

                                     

                                    A more secure way is to set a global field or variable to "YES" (for instance) and then in your security settings you can limit editing to when your "can I edit" variable = "YES". Editing record access privileges