Desktop User Guides > Author > Testing questionnaires > Viewing the questionnaire script > Script sections in the View Script dialog
 
Script sections in the View Script dialog
To provide an overview of how the script corresponds to the options that you select in UNICOM Intelligence Author, the following samples show the script sections from an .mdd file created in Getting started with UNICOM Intelligence Author.
For more information about the Interview Scripting Language, see Interview scripting.
Script header
This section contains information about how and when the script was created. It is automatically generated for use in debugging files created in UNICOM Intelligence Author.
0 : '--- Script header ---
1 : 'NOTE: changes in this section are ignored, to edit remove above comment
2 : ' Interview script created by Routing Script MDSC (Unicode)
3 : ' mrRoutingScriptDsc 1.0.7.2692
4 : ' Date/time script generated: 2007-07-11 12:51
5 :
6 : '--- End script header ---
7 :
This section is displayed in one of the routing tabs when you open the .mdd file in UNICOM Intelligence Professional.
Error handler
This section contains some error handling script for use with Web interviews.
8 : '--- Error handler ---
9 : 'NOTE: changes in this section are ignored, to edit remove above comment
10 : If Not IOM.Info.IsDebug Then On Error Goto __DefaultErrHandler
11 : Goto __StartOfScript
12 :
13 : __DefaultErrHandler:
14 : Dim __err_msg, __error
15 : __err_msg = "Script error at line " + CText(Err.LineNumber) + ", " + Err.Description
16 : IOM.Log(__err_msg, LogLevels.LOGLEVEL_ERROR)
17 : If IOM.Info.IsTest Then
18 : IOM.Banners.AddNew("__ScriptErrMsg" + CText(__error), __err_msg)
19 : __error = __error + 1
20 : End If
21 : Resume Next
22 :
23 : __StartOfScript:
24 : '--- End error handler ---
25 :
This section is displayed in the Web routing tab when you open the .mdd file in UNICOM Intelligence Professional.
Routing section
This section lists all the questions that are asked as part of the routing. If more than one routing exists in your questionnaire, the View Script dialog displays the routing that is currently selected in the Routings pane. It also contains any routing items such as Exit statements, Go To statements, or script items, that you add to the file. Information that changes how a question appears in the routing is also shown here, including templates attached to routings or to questions, and routing options specified in the Properties pane, for example, whether to hide the question or whether the question requires a response.
When you open an .mdd file in UNICOM Intelligence Professional, each routing section is displayed in a separate tab.
Example routing section
The following example is the script produced by the Web_Survey routing section of the file created in Getting started with UNICOM Intelligence Author.
It names the template attached to the routing using the statement IOM.LayoutTemplate = "People_Working_Red_Layout.htm", and then lists each question that forms part of the routing, using the statements QuestionName.Ask. Questions where the Response Required box is checked are indicated by the statement QuestionName.MustAnswer = True. The statement Page.Ask indicates the questions that are grouped in a page. The Email question includes the statement Email.MustAnswer = false to indicate that the Response Required box is unchecked, and also contains statements indicating the changes made to resize the box for the response.
26 : IOM.LayoutTemplate = "People_Working_Red_Layout.htm"
27 :
28 : Title.MustAnswer = true
29 : Title.Show()
30 :
31 : InstantOrGround.MustAnswer = true
32 : InstantOrGround.Ask()
33 :
34 : HowMany.MustAnswer = true
35 : HowMany.Ask()
36 :
37 : DrinkCoffees.MustAnswer = true
38 : DrinkCoffees.Ask()
39 :
40 : FavoriteCoffee.MustAnswer = true
41 : FavoriteCoffee.Ask()
42 :
43 : CoffeeTime.MustAnswer = true
44 : CoffeeTime.Ask()
45 :
46 : '--- Start of page Page ---
47 :
48 :
49 : Page.Ask()
50 : '--- End of page Page ---
51 :
52 : Email.MustAnswer = false
53 : Email.Style.Columns = 50
54 : Email.Style.Rows = 1
55 : Email.Ask()
Metadata section
This section contains information about all the questions that exist in the file, whether or not they are part of any routing. The questions are displayed in the order in which they are shown in the Questions pane. This section also contains information that you have specified about the structure of the question using the Properties pane, for example, minimum and maximum values, or the ordering of the responses in a question.
When you open an .mdd file in UNICOM Intelligence Professional, the metadata section is displayed in a separate tab.
Example metadata section
This is the script produced by the metadata section of the file in Getting started with UNICOM Intelligence Author. The section is bounded by the words Metadata and End Metadata. It indicates the default template and the template location (this location depends on where you save the questionnaire file). It then defines all the shared lists and questions in the file and also defines a page containing the two questions age and gender.
56 : Metadata (en-GB, Question, Label)
57 :
58 : HDATA -
59 : [
60 : Template = "DefaultLayout.htm",
61 : TemplateLocation = "E:\My Questionnaire Files\Coffee Survey 2007_files"
62 : ];
63 :
64 : CoffeeList "" define
65 : {
66 : Costa_Rican "Costa Rican",
67 : Columbian "Columbian",
68 : Java "Java",
69 : Italian_Blend "Italian Blend",
70 : Brazilian "Brazilian"
71 : };
72 :
73 : Title "Survey of Coffee-Drinking Habits 2007"
74 : info;
75 :
76 : InstantOrGround "Do you usually drink instant or ground coffee?"
77 : categorical [1..1]
78 : {
79 : Instant "Instant",
80 : Ground "Ground",
81 : Don_t_drink_coffee "Don't drink coffee"
82 : };
83 :
84 : HowMany "How many cups of coffee do you drink in an average day?"
85 : long [0..50];
86 :
87 : DrinkCoffees "Please say which of these coffees you have ever tried."
88 : categorical [1.. ]
89 : {
90 : use CoffeeList sublist ""
91 : };
92 :
93 : FavoriteCoffee "Which of these types of coffee is your favorite?"
94 : categorical [1..1]
95 : {
96 : use CoffeeList sublist ""
97 : };
98 :
99 : CoffeeTime "At what time do you have your first cup of coffee of the day?"
100 : date;
101 :
102 : Email "Please enter your email address."
103 : text;
104 :
105 : age "What is your age?"
106 : categorical [..1]
107 : {
108 : _18_to_24 "18 to 24" exclusive,
109 : _25_to_34 "25 to 34" exclusive,
110 : _35_to_44 "35 to 44" exclusive,
111 : _45_to_54 "45 to 54" exclusive,
112 : _55_to_60 "55 to 60" exclusive,
113 : _61_and_over "61 and over" exclusive,
114 : Response7 "Refuse" exclusive
115 : };
116 :
117 : gender "What is your gender?"
118 : categorical [..1]
119 : {
120 : Male "Male" exclusive,
121 : Female "Female" exclusive
122 : };
123 :
124 : Page -
125 : page(
126 : age,
127 : gender
128 : );
129 :
130 : End Metadata
131 :
See also
Viewing the questionnaire script