InterSystems IRIS Data Platform 2019.2  /  Business Process and Data Transformation Language Reference  /  BPL Elements

Business Process and Data Transformation Language Reference
Previous section           Next section
InterSystems: The power behind what matters   

Perform a set of activities when a condition is matched within a <switch> element.
<switch>   <case>     ...   </case>    ...   <default>     ...   </default> </switch>
Attribute or Element Description Value
condition attribute Required. If this expression evaluates to true, the contents of this <case> element are executed. If false, this <case> is ignored. An expression that evaluates to the integer value 1 (if true) or 0 (if false). This expression must use the scripting language specified by the containing <process> element.
name, disabled, xpos, ypos, xend, yend attributes See Common Attributes and Elements.”  
<annotation> element
Other elements Optional. <case> 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>.  
A <switch> element contains a sequence of one or more <case> elements and an optional <default> element.
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.
As soon as one of <case> elements is executed, execution control leaves the surrounding <switch> statement. If no <case> condition matches, control leaves the <switch> after the <default> activity executes.
Activities within a <case> element can be any BPL activity, 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 name='No Credit' condition='context.CreditRating=""'>
    <assign name='Not Approved' property="response.IsApproved" value="0"/>
  <default name='Approved' >
    <assign name='Approved' property="response.IsApproved" value="1"/>
    <assign name='InterestRate'
        <![CDATA[Copy InterestRate into response object.]]>

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-09-18 05:38:13