10 Replies Latest reply on Jul 16, 2012 3:05 PM by philmodjunk

    What am I missing?



      What am I missing?


      I'm a newbie and hobbyist and I don't understand what is going on.

      I duplicated an existing layout, which is a report, and then edited the names of the associated table and fields on the layout.

      I then duplicated the script for displaying the layout and made the necessary changes.

      On a tab I have a button which runs script "A" (per button setup).

      When I click the button script "A" runs and displays the original layout and not the intended layout. However if I then click script "A" in the Scrips Menu I am taken to the layout I want.

      I also have other buttons which go to the intended layouts as they should.

      Any idea what I am doing wrong?







        • 1. Re: What am I missing?

          Not without seeing your script.

          To post a script to the forum:

          1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
          2. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
          3. If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          4. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
          • 2. Re: What am I missing?

            Here is the button setup...

            • 3. Re: What am I missing?

              Here is the Script...

              • 4. Re: What am I missing?

                That shows the name of the script you've selected, but not the script itself. You'll need to open that script in a script editor and capture that screen image. From the above dialog, you can pull down the "gear" drop down and select "edit". Or you can find the same script in Manage Scripts and double click it.

                • 5. Re: What am I missing?

                  I duplicated the original layout.

                  I modified the new layout to reflect the correct table.

                  I duplicated the original script and modified it accordingly to reflect everything correctly.

                  In button setup I chose the new script to be run (let's call it Script A)

                  What happened before not surprisingly happeded again, i.e., the original layout displayed, I clicked Script A in the scripts menu and was presented the new layout.

                  Why is the original layout presented such that I have to choose the new script to get the new layout displayed?

                  I will gladly email my database to someone if they would like to take a closer look.

                  Keep in mind I am self-taught, newbie, hobbyist.

                  My database will eventually contain names and addresses for my personal use.

                  I choose my database as a starting point on how to learn and utilize FileMaker Pro 12 Advanced.




                  • 6. Re: What am I missing?

                    What is the name of the original layout?

                    What is the name of the new layout that you created by duplicating it?

                    This may be too obvious, but I've got to ask it to be sure: What names did you give the original and new scripts?

                    Do you have any script triggers defined in Layout Setup... for either of these two layouts?

                    Since you have FileMaker Advanced, I suggest enabling the script debugger and running your script. This way you can watch your script and step through it one step at a time. If any script triggers are tripped by this script, they will also pop up in the debugger window and if this happens, chances are that you've found the reason for the unexpected script results.

                    • 7. Re: What am I missing?

                      I ran the Script Degugger as you suggested. Note: This is my first use of the Script Debugger.

                      I'm assuming the top item in the Call Stack List Box, i.e., State Definitions — All is the last step to be acted upon?

                      Note: State Definitions — All is the layout which displays when the button is clicked which requests the CSZ Definitions — All layout.

                      Am I right in assuming the CSZ Definitions — All layout may go by so fast it is not even discernable?

                      So when I edit the script CSZ Definitions — All you see it doesn't contain anything about the State Definitions — All layout.

                      However the script State Definitions — All shows it when the script debugger is activated.

                      How did State Definitions — All get in the mix? It doesn't show up when I edit the script?

                      Should I just delete the CSZ Definitions — All script and just hand enter it instead of copying and pasting the steps I took from State Definitions — All script?







                      • 8. Re: What am I missing?

                        From what I see, you have more than one script in your call stack.

                        The call listed on the top of the stack is the one currently executing. I can't get something that looks like your screen unless I click on the bottom line of the call stack.

                        Yes, a script can change layouts so fast that you don't see anything on the screen when it happens.

                        It looks like your script is tripping a layout based script trigger on the layout. I'd open layout setup and examine the settings on the script triggers tab to see what is found there.

                        Are you sure that this screen shot is from clicking the Button? I get a a different icon that shows that script was performed from a button click.

                        • 9. Re: What am I missing?


                          The problem was in the script triggers.

                          I'm not sure why but I managed to set a script trigger in my initial report layout which I then used as a template.

                          As a consequence the script trigger was propogated in all the other report layouts.

                          I hadn't set a script trigger in the layouts used to maintain my tables so there was no problem there.

                          I learned two things today.

                          To make use of the script debugger and the impact of script triggers.

                          Thanks for all your insight.



                          • 10. Re: What am I missing?

                            There are two approaches you can use to avoid having a script "trip" layout based script triggers:

                            1) Set up a "hidden" trigger free utility layout. This can be a completely blank layout in most cases, but based on the same table occurrence as the layoutwith the trigger you want to avoid. Your script freezes the window and changes to this hidden layout (Not listed in the layouts drop down.) instead of the one with the trigger. Please note that if the trigger is an OnLayoutExit trigger or an OnRecordLoad trigger set on the layout you are starting out from, this method can't be used.

                            2) Use a global field and careful coding to "turn off" your triggers when you don't want them to be tripped by your scripts.

                            Put every layout script trigger controlled cript inside this If block:

                            If [Not $$TriggersOff ]

                              #Put the rest of your script here

                            End If

                            For every script that might trip such a trigger when you don't want it to:

                            Set Variable [$$TriggersOff ; value: True ]
                            Go to Layout
                            Set Variable [$$TriggersOf ; value: False ]