3 Replies Latest reply on Jun 14, 2014 12:05 PM by deathrobot

    Script Debugger versus live run

    deathrobot

      Title

      Script Debugger versus live run

      Post

           I have a script that is not working correctly. However, when I run it through Script Debugger, it works just fine. Are there differences that can happen when the script is going slowly/step by step? If so, is there something to look at that could cause it to fail in real time versus going through the debugger (e.g. "commit record" or…?) BTW, the script is not calling data from a webviewer or anything that would take time to retrieve. It's all basic record manipulation.

           Thanks,

           Michael

        • 1. Re: Script Debugger versus live run
          SteveMartino

               This has been discussed before, and does happen, but I can't seem to find the thread.  What error messages, if any are you getting with the debugger?

               It may be helpful to provide more information, like what do you mean by 'not working'.

               If you can post your script that may also help.

          • 2. Re: Script Debugger versus live run
            philmodjunk

                 The most common way to get a difference in results is simply the fact that the script pauses and updates the screen on every step. In a few cases, that can result in different results. You can also have a script where subtle differences in your found set/current record/sort order etc can result in it "working" sometimes and not others. That sometimes creates the illusion that it works in the Debugger and fails when not in the debugger.

                 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 New Answer.
            2.      
            3.           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. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
            4.      
            5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
            6.      
            7.           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.
            • 3. Re: Script Debugger versus live run
              deathrobot

                   Steve, the script debugger shows no errors. The trouble the live script produces is duplicate records in the join table (but with different related id's on one side of the relationship). And based on what you said, Phil, about the debugger updating after each script, I suspect it is a missing commit records step. I use Matt Petrowsky's id field calculation, which prevents duplicate ids on merges by replacing itself in that one situation. I'm guessing when I make a new record, I get one id, but after modifying the record before committing it, get a new id. This would explain getting no duplicate records in the main table, but getting them in the join table. I'll play around with this some more (and if it works, make sure I always put a commit records step after making a new record.)

                   Thanks!