iTP Active Transaction Pages (iTP ATP) Programmer's Guide

Designing and Debugging ATP Applications
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide522292-002
6-4
Displaying Variables
Include error-handling logic after each SQL and TMF operation. Obtain and display
the transid and transaction status, both properties of the atp.transaction
object.
Displaying Variables
Use any of the following techniques to display values of variables:
Add atp.print() statements to the page.
Explicitly print a closing HTML tag to force display of data. (Browsers often do not
output data until a closing HTML tag is encountered.) Try
atp.print('</td></tr></table>' + my_variable). If in the
<head> section, try atp.print('</head>' + my_variable).
Print the contents of an array with one statement of the form
atp.print (my_array)
Print the data type of a variable with a statement of the form
atp.print (typeof my_var);
Print a function definition with a statement of the form
atp.print (my_func);
Enumerate and print the properties of an object with a statement of the following
form, where prop is a property of object x
for (prop in x) {
atp.print ("x contains " + prop + " whose value is " +
x[prop]) }
Log changes in variable values using the Javascript watch feature. The file
/examples/debugging/watchlib.inc on the ATP CD demonstrates this
feature by implementing a debugging object called watchlogObject. This object
logs changes in the values of variables, including the name of the function
responsible for each change. A property and methods defined for the object let you
accumulate the trace information in a buffer and later display the information in the
current window or a new window.
While developing or debugging a page, include a function that prints the values of
request variables. Example 6-3 shows an example function: