Friday, December 21, 2012

Simple Debugging of Server Scripts

Server scripts don't really lend towards debugging well.  Its the nature of how they are written.  Still you can do a few things to get back values and figure out if the code you have generated is acting like you want.

Normally I employ :RETURN statements like you would use alert or dialogs to give back localized variable information.  That allows you to at least watch a variable and check its output.

You can also run it like you do a form (CTRL + F5) and get the final outcome though you'll probably want something more flexible -- hence the use of :RETURN statements at strategic intervals to get some basic info.  Its not as good as setting a watch on variables and capturing outputs but you can add some basic code to help.

If you have constrained ranges you need to watch for then use :IF statements with :RETURN statements for good effect.

I've tried to employ the :CHECKPARAM statement but it doesn't seem to work as advertised in the server scripts.

--- Update ---

So, :RETURN works in a flexible fashion.  Use it to find variable values but also remember it can provide a true or false return for sqlexecute functions to make sure they are working properly.

Also, it ends the execution of the server script where ever you place it so its a good way to isolate errors.

No comments:

Post a Comment