How to See Values of Variables

If you run Panorama X using Terminal.app, you can use the nslog statement to display intermediate values as a program is running.

To do this, first launch Terminal.app (it’s in the /Applications/Utilities folder). Then enter this line to launch PanoramaX (assuming it is in the /Applications folder).

/Applications/PanoramaX.app/Contents/MacOS/PanoramaX

Now in your code, you can insert nslog statements to display a variable, or any formula for that matter. This statement works like the message statement, but instead of displaying an alert, the calculated value is displayed in the terminal window. When you run your code in Panorama, the output of nslog shows up in the terminal. This is really great for loops, because instead of having to slowly step thru the code, you can see the progression of data values immediately.

If you are using this for different variables, you probably want to add additional text to identify what each item is, for example:

nslog "index: "+index

When you’re finished debugging you can remove the nslog statements.

Here is an example of a procedure with nslog statements.

nslog "Run "+info("procedurename")
firstrecord
loop
   nslog "A = "+A
   downrecord
until stopped

When you run this procedure, here is what appears in the Terminal window (in this case my database has three records, and field A contains alpha, beta, gamma):

2017-10-26 14:09:10.687 PanoramaX[13854:40089217] Run Scan Field A
2017-10-26 14:09:10.769 PanoramaX[13854:40089217] A = alpha
2017-10-26 14:09:10.787 PanoramaX[13854:40089217] A = beta
2017-10-26 14:09:10.823 PanoramaX[13854:40089217] A = gamma

I think you’ll find that this technique works really well to be able to quickly see what is going on in your procedure code.