SurveyQuestionXMLMDSC examples
See also
Inline example
Categories can be rendered as sublists, using subheadings, or with category lists. The categories can be rendered in a single, inline list.
Metadata script: Inline method 1
Q1 "Q1" categorical
{
List1 inline "Sub heading 1"
{ a "a", b "b", c "c" },
List2 inline "Sub heading 2"
{ x "x", y "y", z "z" }
};
Metadata script: Inline method 2
List1 "Sub heading 1" categorical
{ a "a", b "b", c "c" };
List2 "Sub heading 2"
{ x "x", y "y", z "z" };
Q1 "Q1" categorical
{
use List1,
use List2
};
Rendered
XML
<Question QuestionFullName="Q1" QuestionDataType="Categorical">
<Category Name="List1" Value="38" CategoryType="CategoryList"
<Category Name=”a” Value="35">...</Category>
<Category Name="b" Value="36">...</Category>
<Category Name="c" Value="37">...</Category>
</Category>
<Category Name="List2" Value="43" CategoryType="CategoryList">
<Category Name="x" Value="32">...</Category>
<Category Name="y" Value="33">...</Category>
<Category Name="z" Value="34">...</Category>
</Category>
</Question>
See also
Subheadings example
This example uses subheadings.
Metadata script: Sublist method 1
Q1 "Q1" categorical
{
List1 "Sub heading 1"
{ a "a", b "b", c "c" },
List2 "Sub heading 2"
{ x "x", y "y", z "z" }
};
Metadata script: Sublist method 2
List1 "Sub heading 1" categorical
{ a "a", b "b", c "c" };
List2 "Sub heading 2"
{ x "x", y "y", z "z" };
Q1 "Q1" categorical
{
use List1 sublist,
use List2 sublist
};
Rendered
XML
<Question QuestionFullName="Q1" QuestionDataType="Categorical">
<Category FullName="sublist1" IsSubList="True" Value="38"
CategoryType="CategoryList">
<Category Name="a" Value="35">...</Category>
<Category Name="b" Value="36">...</Category>
<Category Name="c" Value="37">...</Category>
</Category>
<Category Name="sublist2" DisplayAsSublist="True" Value="43"
CategoryType="CategoryList">
<Category Name="x" Value="32">...</Category>
<Category Name="y" Value="33">...</Category>
<Category Name="z" Value="34">...</Category>
</Category>
</Question>
See also
Normal case example
Other questions that are locally defined (normal case)
When a category is specified as an Other category, the other questions can be defined locally, as part of the question where the category is defined, or they can refer to another question. This example shows a question that is defined locally.
Metadata script
Q1 "q1" categorical
{
e1 "e1",
e2 "e2",
eOther "eOther" other
};
Rendered
XML
<Question QuestionFullName="Q1" QuestionDataType="Categorical">
<Category Name="e1" Value="35">...</Category>
<Category Name="e2" Value="36">...</Category>
<Category Name="eOther" Value="37" Type="Category" IsOther="True">
<Question QuestionName="eOther" QuestionFullName="Q1.eOther"
QuestionDataType="Text"/>
</Category>
</Question>
See also
Other category that refers to a separate question example
This example provides an Other category that refers to a question that is defined elsewhere.
Metadata script
Q2 "q2" categorical
{
e3 "e3",
e4 "e4",
eOther "other cases" other(use q1.eOther
};
Rendered
XML
<Question QuestionFullName="Q2" QuestionFullName="Q2" QuestionDataType="Categorical">
<Category FullName="e3" Value="38">...</Category>
<Category FullName="e4" Value="39">...</Category>
<Category FullName="eOther" Value="40" IsOther="True" OtherReference="Q1.eOther">...</Category>
</Question>
See also
Long validation example
The following example provides a long question that uses a range, and shows how the range is specified for validation. The example allows whole numbers between 1 and 10 inclusive, except for 5, 6, and 7; that is: 1, 2, 3, 4, 8, 9, 10.
Metadata script
Grade long [1..10, ^5..7];
Rendered
–
XML
<Question QuestionFullName="Grade" QuestionDataType="Long">
<Label><Text>"Grade"</Text></Label>
<Validation MinValue="1" MaxValue="10" RangeExpression="1..10, ^5..7"></Validation>
</Question>
See also
Loop iteration validation example
This example shows a numeric loop where the iterations are specified using a range, and shows how the range is specified for validation.
Metadata script
Loop1 "Please list the names of the people in the household" loop [1..3, 6..10] fields
(
SubQ text[1..10];
) expand;
Rendered
XML
<Question QuestionFullName="Loop1" QuestionType="LoopNumeric" Iterations="[1..3,6..10]">
<Question QuestionName="SubQ" QuestionFullName="Loop1.SubQ" QuestionDataType="Text">
<Validation MinValue="1" MaxValue="10"/>
</Question>
</Question>
See also