1 2 Previous Next 15 Replies Latest reply on Dec 8, 2010 12:20 PM by gaby58

    Button is not performing a script

    gaby58

      Title

      Button is not performing a script

      Post

      The button is assigned a Perform Script and when it is clicked it is not performing this, what could be the reason? The same perform script function works for other button, what could be the reason?

      Thanks for any feedback

        • 1. Re: Button is not performing a script
          philmodjunk

          What does the script do? Any chance it is performing but not the way you expect it to?

          If you have FileMaker Advanced, enable the script debugger and click this button to watch what happens. If you do not, edit your script to add a Show Custom Dialog step as the first step of your script. Click your button and see if the dialog appears. You can also add other Show Custom Dialog steps throughout your script to "trace" through what is happening in your script.

          If can't get the first custom dialog to appear then the script is not being performed and something is odd with your button set up or perhaps you are in layout or preview mode.

          • 2. Re: Button is not performing a script
            gaby58

            Thanks for the response, I used the Script Debugger and when I click the button it goes to Perform Script function and stops, then if I step through it, it goes to each of the steps like Commit Records, then Set field etc, but nothing happens. This is supposed to open an another box where we can enter information and that gets stored in the database. What should I be doing, I am kind of new to this File maker...

            • 3. Re: Button is not performing a script
              philmodjunk

              I'd need to see your script. Since you have advanced, make a database design report and then copy and paste this script from the report to this forum so that we can take a look.

              Also, keep in mind that the current layout and current sort order can affect how many scripts  perform.

              • 4. Re: Button is not performing a script
                gaby58

                Script Name

                Go to Test Pop UP

                Run script with full access privileges

                Off

                Include In Menu

                No

                Layouts that use this script

                 

                Scripts that use this script

                 

                Script Definition

                Script Steps

                • Commit Records/Requests [ No dialog ]
                • Set Field [ Test::IsActive; "YES" ]
                • Set Field [ Test::Variant Code; "01" ]
                • Set Field [ Test::Rating; "1" ]
                • Commit Records/Requests [ No dialog ]
                • Go to Related Record [ From table: “Test_PurchaseOrder TestInfo”; Using layout: “Test Detail Pop Up” (Test) ] [ Show only related records; New window ]
                • Perform Script [ “Hide Status Bars and ResizeToFit Layout” ]

                Fields used in this script

                • Test::IsActive
                • Test::Variant Code
                • Test::Rating

                Scripts used in this script

                Layouts used in this script

                • Test Detail Pop Up

                Tables used in this script

                 

                Table occurrences used by this script

                Custom Functions used by this script

                 

                Custom menu set used by this script

                 
                • 5. Re: Button is not performing a script
                  philmodjunk

                  There are several possibilities to check. The most likely culprit is the Go To Related Record step. If there are no related records to go to, this step simply fails to execute and the script moves on to the next step. It's safest to include a test to confirm there actually are related records just before the GTRR step and to not let the script proceed if there aren't.

                  Another possibility is that you are running this script from the wrong layout. In Layout Setup.... for the layout where you placed this button, what table occurrence is listed in "show records from"? It should list either "test" or a table occurrence that is related to "test" in order for the three set field steps to work. And GTRR won't work unless the current layout refers to a table occurrence that is directly or indirectly related to “Test_PurchaseOrder TestInfo”--though this should trigger an error if this were the case.

                  • 6. Re: Button is not performing a script
                    gaby58

                    Thanks, actually I checked for GTRR and this has been used in another layout and there if there are no records it works fine too..

                     

                    I also tried adding Show Custom Dialog as first step and nothing happens, same buttons have been used in other layouts and there it works fine...

                    • 7. Re: Button is not performing a script
                      philmodjunk

                      If there are no related records, GTRR will do absolutely nothing. No change in layout takes place, no new window opens.

                      Please note my comments one what layout is current at the time the script executes. The fact that a script runs correctly with layout A does not mean it will run correctly with Layout B, since the two layouts may refer to completely different table occurrences and this "context" has a great deal to do with what records and fields are accessible to your Set Field steps and what results a GTRR produces.

                      Try this: Enable the script debugger and step through the script with the data viewer enabled. Watch to see if each set field successfully assigns a value to the field it refers to. Check Last Error after each step. If it reports anything but zero, stop and click the number to look up what that error number is.

                      Note: Table Occurrences are the boxes found at Manage | Database | Relationships. Every layout and every portal refers to exactly one of these occurrences. Each table occurrence has its own current record, current found set and current sort order for a given FileMaker window. This is what makes "context" a key issue here.

                      • 8. Re: Button is not performing a script
                        gaby58

                        Thanks, I tried it and it says error 101 and this means record is missing, since record is missing, what can be done. Actually this one is supposed to create a new record....

                        Also when I use SetField Script, how do I assign IsActive:1, it is just taking IsActive, can not assign this value though

                         

                        • 9. Re: Button is not performing a script
                          philmodjunk

                          On what step of your script do you see this error number? The first set field or ?

                          I believe you are on the wrong layout for this script to work. That would explain both the error number and what I think is taking place when you report: when I use SetField Script, how do I assign IsActive:1, it is just taking IsActive, can not assign this value

                          When you enter layout mode on this layout and open Layout Setup... from the layouts menu, what do you see in "Show Records From"?

                          • 10. Re: Button is not performing a script
                            RickWhitelaw

                            Perhaps the Error 101 is after the GTRR step. It's (IMHO) always best to trap (capture) error 101 when using GTRR. Otherwise the script step, as Phil has pointed out many times, will fail without "notice".

                            RW

                            • 11. Re: Button is not performing a script
                              gaby58

                              Setfield is used in another script and there it can be assigned and it is used in the same way, but not sure why I can not assign 1 here.

                              Also the layout is using PO table and the script is using test_PO testInfo table. The same way it is used for SO layout and it works fine there, this is becoming a mystery...

                              Thanks

                               

                               

                              • 12. Re: Button is not performing a script
                                philmodjunk

                                Also the layout is using PO table and the script is using test_PO testInfo table.

                                According to the script you posted, the script does not use test_PO, it uses test. Test and test_PO may refer to the same data source table, but that does not mean you can use them interchangeably.

                                What relationship, if any links a box on your relationship graph named "PO" to a box named "Text"? I believe that's the key to why this isn't working for you. To repeat myself: what relationships (and their table occurrences) your script and current layout refer to can keep both the set field and GTRR from working as expected.

                                You never answered this question: At what script step do you first see the error code?

                                • 13. Re: Button is not performing a script
                                  gaby58

                                  I see the error code at GTRR

                                  • 14. Re: Button is not performing a script
                                    philmodjunk

                                    That indicates that there are no related records for the table occurrence (Test_PurchaseOrder TestInfo) you've specified.

                                    There are several reasons why that might be the case. GTRR brings up the matching records from the persective of your current layout's specified table occurrence. If you see "PO" in the "Show Records From" drop down in layout setup..., you need to open Manage | Database | Relationships, find the box labeled "PO" and the box labeled "Test_PurchaseOrder TestInfo". Is there a relationship directly linking the two? What fields in PO are defined to match records in Test_PurchaseOrder TestInfo? If there isn't a direct relationship this gets a lot more complicated as the records present in the "in between" tables also will affect what related records if any exist in Test_PurchaseOrder TestInfo.

                                    not sure why I can not assign 1 here
                                    To repeat: if your layout is based on PO, you won't be able to change values in test unless there is a valid relationship linking PO to Test. New info: Unless this relationship is defined to "allow creation of records via this relationship", a matching record in test must exist before you can assign one to a field in test.

                                    1 2 Previous Next