The other day I was unit testing a FileMaker script that reassigned a bunch of field values in a set of records. I needed to pay close attention to the values being captured at each step, so I was using the debugger and the data viewer to keep an eye on things.
I tend to use a lot of SetVariable steps, to keep my code tidy and efficient. So in this particular case, I was primarily concerned with the values being stashed into a set of variables. But when I looked for them in the data viewer’s Current pane, they often weren’t there at all.
Sometimes this happens normally, when the value of your variable is null. Keep an eye out for that so it doesn’t catch you off guard. But in my case, I knew those values weren’t null — so where were those variables in my viewer? Every once in a while they’d show up as expected. Weird!
Finally I saw the pattern: if the data viewer was opened BEFORE the script started, all the variables showed up properly. But if I waited until a few steps into the script to open up that data viewer window, my script variables never showed.
So keep that data viewer window open during your debugging, so you get the complete view of Current expressions.
I had been closing the data viewer when I went to adjust my code, because it stays on top and tended to obscure my view. Then I’d forget to reopen it until I was already running the test. Once I figured out the behavior, I started resizing the data viewer window instead, shrinking it and moving it on top of my debugger window while I edited my script, to keep it always open but out of the way.










Posted by jbelber on July 28, 2009 at 12:59 pm
