How to See Values of Variables

Hello Everybody,

I just purchased and downloaded Pan X. Immediate problems.

I will attempt to solve by myself, but I need some preparatory advice first.

1- I am not able to “single-step” through a procedure. The procedure pauses at the first debug statement, but then runs through the next batch of lines quickly before pausing once again, and then running through the next batch. So I cannot see what the program is actually doing during the intervening steps.
2- There doesn’t seem to be an “inspector” window in Pan X. How does one follow the values of variables during a procedure? This is really critical for me, because most of my macros are calculation intensive. I know there is a function -
datavalue( - that does this, but I need to follow many variables at once as the macro steps through its paces. Surely there must be a special inspector window that follows variables values.

Maybe if I get resolution on the above, I can get going on my own. If not, Pan X will be of limited use for me.

Best regards,

There are known problems with single stepping. For now, you will have to use other debugging techniques.

The inspector window in Panorama 6 never worked correctly or reliably. So far, we have not attempted to implement this feature in Panorama X. For anything but local variables, you can look at variable values thru the Formula Wizard, which now allows you to look at multiple formula results at once. Click the refresh icon to see the latest value. You can also display values on a form.

For local variables, I usually use the message or nsnotify statement.

OK, Jim. I was planning to make a form window to do that. But I still need to see the values after each step. If the macro RUNS through many steps at once, I will still have the problem of knowing the variable’s value at intermediate steps. Not sure what to do at this point.

I know this will be fixed in due course. Maybe I should just hang with Pan 6 until a future version addresses this issue.

Best regards,

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

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


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")
   nslog "A = "+A
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.

That is an awesome tip.

Hello Jim,

Some more on my new attempts to master Pan X. I can see this is still a work-in-progress.

Rather than your suggestion of using the Terminal app, I just entered a bunch of debug statements in the code. They will be ignored once I close the procedure window anyway, so no need to enter a bunch of nslog statements.

Here is what has happened:

1-Has it been previously reported that the setwindow command terminates a macro? Or more precisely, causes the macro to reset itself, and begin again in an endless loop. I commented-out the statement, and opened the window manually.
2- The window has a Text Display object, with the formula

 pattern(g_startBal + g_t1 - g_t2),"$#.##")

The value of g_startBal is a number, but g_t1 and g_t2 start out as “”. Shouldn’t Pan X know to use a zero for those variables initially, until the macro resets them with actual number values? Instead, Pan X gives an error in the object “Cannot subtract”. This did not happen in Pan 6.

Jim, personally I think you should devote a higher priority to a new Inspector window. Being able to follow the values of multiple variables during a macro is essential, at least to me. I’m surprised others have not commented to you on this before now.

Best regards,

You can always use a massage statement to find out the value of any variable at any time during the running of a procedure, as in:

message my variable.

This will pause the procedure and display the contents of a variable then continue when dismissed.

No, I don’t think it should. Panorama 6 didn’t do that either. How is “” getting into these variables? They must be getting initialized somehow, why to you reset them to 0 instead? Or, you could use the val( function, like this.

pattern(g_startBal + val(g_t1) - val(g_t2)),"$#.##")

Often in a situation like this a variable might not be initialized at all. That’s apparently not the case in your situation, based on the error message. But when it is the case, you can use the new catcherror( function like this:

pattern(g_startBal + catcherror(0,g_t1) - catcherror(0,g_t2)),"$#.##")

I use catcherror( a lot, it’s very useful in form objects especially.

In Pan 6, the error was “Type mismatch. A number was encountered when text was expected.”

“” is text, and you said g_startBal was a number. In Pan 6, that’s a type mismatch, and that’s an error. Panorama X will handle a type mismatch, when the operator is +, by converting the number to text and concatenating the two text values, so g_startBal+g_t1 will return text. The subtraction that follows then, is a subtraction between two text values, which makes no sense.