Turning on script debugging – debug(1)
- To start the Xbasic Debugger, add the instruction debug(1) to your script or function.
- debug(1) means “Turn the Xbasic Debugger ‘on’, and start debugging with the next instruction”.
- When you start the Component in Working Preview or Live Preview, the instruction will execute, and the Xbasic Debugger will start.
- If you want to debug multiple scripts or functions, you must add the instruction debug(1) to each script or function you want to debug.
Observe as the instructor turns on debugging for a Component.
- Be sure the Design window for the RevenuePieChart Component is open.
- Click Xbasic functions.
- In the script window, locate the line that begins passThisCustomerIDin =, and open a new line above it.
- On that new line, enter debug(1). In the script prompting, notice the other possible settings for debug.
- Click the Working Preview tab.
- The Xbasic Debugger window appears:
- The Xbasic Debugger suspended executing the script at the first instruction following debug(1).
- The Xbasic Debugger displays an arrow to indicate where it suspended execution.
- Orient yourself to the Xbasic Debugger window:
- Just above the script window, the row of buttons offers typical debugger features.
- Look at the options of the Debugger menu; they offer some of the same features as the buttons, and more.
Meanwhile, back in Working Preview…
- View the Alpha Anywhere window.
You may see that it appears to be empty/blank, and may have this title:
This illustrates a critical aspect of debugging: you’re either debugging or not.
- You cannot debug a script and at the same time run the Component in Working Preview, or modify the script or a Component or the Project.
- There is no way to switch between working with the Xbasic Debugger window and working with the Design window or Working Preview.
- Now you turn on debugging for the same Component and script.
- Try the Component in Working Preview.
- When the Debugger window is active, try looking at the Working Preview window again.