Creating Diagnostic Messages
		
		
		
		Jump to navigation
		Jump to search
		
Information can be shown in a message box. For example, the following checks to see if a variable called weight exists and, if it does not, alerts the user:
if (data_file.getVariableByName("weight") == null) 
   alert("Data file does not contain a variable called 'weight'.");
Alternatively, we can print messages in an output windows. The following prints the value of Don’t know (see the earlier example in this chapter):
log("Don't know in the age question has the value of " + dk_value);
See also
- Next worked example.
 - QScript Selection Functions.
 - QScript for an explanation of how to run this code.
 - QScript Reference for technical information.
 - JavaScript for information about the JavaScript programming language.