<default>
Syntax
<switch> <case> ... </case> ... <default> ... </default> </switch>
Details
Attribute or Element | Description |
---|---|
name, disabled, xpos, ypos, xend, yend attributes | See Common Attributes and Elements.“ Note that the default for name is “Default” |
<annotation> element | |
Other elements | Optional. <default> may contain zero or more of the following elements in any combination: <alert>, <assign>, <branch>, <break>, <call>, <code>, <continue>, <delay>, <empty>, <flow>, <foreach>, <if>, <label>, <milestone>, <reply>, <rule>, <scope>, <sequence>, <sql>, <switch>, <sync>, <throw>, <trace>, <transform>, <until>, <while>, <xpath>, or <xslt>. |
Description
A <switch> element contains a sequence of one or more <case> elements and an optional <default> element.
When present, the <default> element must be the last element in the <switch>. Correspondingly, in the Business Process Designer, the <default> element must be the right-most option in the <switch> part of the diagram.
When a <switch> element is executed, it evaluates each <case> condition in turn. These conditions are logical expressions in the scripting language of the containing <process> element. If any expression evaluates to the integer value 1 (true), then the contents of the corresponding <case> element are executed; otherwise the expression for the next <case> element is evaluated.
If no <case> condition is true, the contents of the <default> element are executed.
Activities within a <default> element can be any BPL activity listed above, including <assign> elements as in the example below:
<switch name='Approved?'> <case name='No PrimeRate' condition='context.PrimeRate=""'> <assign name='Not Approved' property="response.IsApproved" value="0"/> </case> <case name='No Credit' condition='context.CreditRating=""'> <assign name='Not Approved' property="response.IsApproved" value="0"/> </case> <default name='Approved' > <assign name='Approved' property="response.IsApproved" value="1"/> <assign name='InterestRate' property="response.InterestRate" value="context.PrimeRate+10+(99*(1-(context.CreditRating/100)))"> <annotation> <![CDATA[Copy InterestRate into response object.]]> </annotation> </assign> </default> </switch>