In this article
The Check Script Code functionality will check your survey looking for syntax errors in your coding. Authoring will check conditions, question and column masks, code masks, validation code, script nodes, and response piping. You DO NOT have to compile or generate to use this feature.
Note: The script code must be written in JScript.NET (.NET survey engine) to use the script checker. This code check is for syntax errors only, so there could still be other types of errors in your survey, for example, trying to set a value in a question with too many characters according to field width, etc. Such errors can be found through run-time testing of the survey (i.e. going through survey in Test mode). You can also use the Random Data Generator to find run-time errors (go to Random Data Generator for more information).
To access the script code check functionality, go to the Designer > Quality Control > Check Script Code menu command, or right-click the survey folder in the Survey tree toolbox and choose Check Script Code from the menu.
Authoring will start running through the Survey and checking the code. A new pane opens in the lower-right part of the window, displaying the message “Please wait, loading list…”. Once the checking process is finished, any errors discovered will be displayed in the pane - .
Figure 1 - Example of an error list
The Question ID column displays the question ID or the script ID where the error is located. The Error column provides a short summary of the error type.
Click the error link to open the erroneous question, script, condition, etc., in the frame above the error pane. The erroneous question, script, condition, etc., will be highlighted in the Survey - .
Figure 2 - Example of an opened error
You can then locate the error, correct it, click Save, and open the next error in the script code error list. When you have corrected all errors in the list, you can run the Check Script Code one more time. The check will also control if the Survey has any questions with empty answers or illegal properties. The following checks will be run before the code check:
Single questions:
- must include answers in the answer-list when not in a 3D Grid
- the property Drop-down cannot be set when in a 3D Grid
Multi questions:
- must include answers in the answer-list when not in a 3D Grid
Grid questions:
- must include answers in the answer-list when not in a 3D Grid
- must include scale
3D grid questions:
- must include answers in the answer-list
- must include questions
The empty answer and property errors will be displayed one by one in the error list. This means that, if you have two multi questions with no items in the answer list in the Survey, and one code mask error, the following will happen: The first time you check the code, the system will inform you that answers are missing in one of the multi questions (the first one in the Survey). You will have to insert the answers and check the code again. This time the system will detect that answers are missing in the other multi question. You will have to correct the error and check the code again. This time the system will find the code mask error. You will then have to correct the error and check the code again.
Note: The same check will be run during the WI generation, under Survey Launch.