Mobile SDK > Disconnected mobile application reference > SurveyRoutingXMLMDSC reference > SurveyRoutingXMLMDSC examples
 
SurveyRoutingXMLMDSC examples
Author routing script and XML example
IfBlock example
This example shows the Author representation of a categorical question Ask, followed by branching to one of three numeric questions that are based on the answer. The routing script represents how the Author interface displays when the MDD file is opened in UNICOM Intelligence Professional.
Author
Author routing pane
Routing script
If q1.ContainsAny({a}) Then
  '##NAME##:If
  '##PROP##:11:Question:Expression_Passed_Validation=true
  age1.MustAnswer = true
  age1.Ask()
ElseIf q1.ContainsAny({b}) Then
  '##NAME##:ElseIf
  age2.MustAnswer = true
  age2.Ask()
Else
  '##NAME##:Else
  age3.MustAnswer = true
  age3.Ask()
End If
'##NAME##:Check
XML
The following Routing XML segment is generated for the Check block in the Author routing script example. For the If and ElseIf checks, the XML contains both a text representation of the conditional expression, and the corresponding Opcodes that can be run by the Expression Evaluation component.
<IfBlock Name="Check">
<If Name="If" Expression="q1.ContainsAny({a})">
<Opcodes>
<Opcode Code="PushCategorical">
<Operand>{a}</Operand>
</Opcode>
<Opcode Code="PushVariable">
<Operand>Q1</Operand>
</Opcode>
<Opcode Code="Function">
<Operand>ContainsAny</Operand>
<Operand>2</Operand>
<Operand>True</Operand>
</Opcode>
</Opcodes>
<Routing>
<Ask Name="age1" Question="age1" />
</Routing>
</If>
<ElseIf Name="ElseIf" Expression="q2.ContainsAny({b})">
<Opcodes>
<Opcode Code="PushCategorical">
<Operand>{b}</Operand>
</Opcode>
<Opcode Code="PushVariable">
<Operand>Q2</Operand>
</Opcode>
<Opcode Code="Function">
<Operand>ContainsAny</Operand>
<Operand>2</Operand>
<Operand>True</Operand>
</Opcode>
</Opcodes>
<Routing>
<Ask Name="age2" Question="age2" />
</Routing>
</ElseIf>
<Else Name="Else">
<Routing>
<Ask Name="age3" Question="age3" />
</Routing>
</Else>
</IfBlock>
See also
SurveyRoutingXMLMDSC reference