Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Troubleshooting tips

Troubleshooting techniques

Scroll Prev Next More

 

When your projects do not work as expected, especially when you use lots of events and custom code, you can use the following debugging techniques to resolve the issue.

Print extended debug info on the web page

To enabled extended debug info, add the following code to the AfterAppInit event:You can display the debug info by adding the following code to the AfterAppInit event:

 

GlobalVars.dDebug = true;

 

 

 

Once this option is enabled, your application will print all SQL queries it executes, output from third party REST requests and.

 

 

Note: Outputting SQL queries or other debug info will break AJAX functionality like buttons, field events, popup windows, lookup wizards in AJAX mode etc.

 

You can copy the SQL query and run it against your database manually to see if it returns correct results.

 

To run an SQL query manually, use the tools that come with the database (Query designer in MS Access, Enterprise Manager in SQL Server, phpMyAdmin in MySQL).

 

This debug info setting will also apply to REST Views. Once this option is enabled REST View pages will output all requests sent to the REST API provider.

 

rest_view_debug

Print out variables using the Echo statement

The Echo command is used to write output to the browser. The following example sends the text "Hello World" to the browser:

 

MVCFunctions.Echo("Hello World");

 

Here are several examples of how you can use this command:

Print the value of the variable

MVCFunctions.Echo("Variable name: " + variable.ToString());

With BeforeAdd/BeforeEdit events, you can print form field value

MVCFunctions.Echo("field_name: " + values["field_name"].ToString());

 

Note: visit the corresponding articles to learn more about BeforeAdd/BeforeEdit events.

Displaying a session variable that stores the authorized user's ID

MVCFunctions.Echo("UserID: " + XSession.Session["UserID"].ToString());

See also:

Troubleshooting custom buttons

Troubleshooting JavaScript errors

Events: After application initialized

Event: BeforeAdd

Event: BeforeEdit

Save user data in session variables

About SQL query screen

Improving performance of your web applications

Troubleshooting web applications