If / Sub-action: Else

Tag: Else


The Else function only works if it comes directly after an </if> tag. Any tags put between </if> and <else> will generate an error and actions within the <else> block will only be executed only if the <if> condition is evaluated as false.

XML
<Else/>

Example Script

XML
<ytriaAutomation>
	<If Test="SelectionCount" Mode="Equals" Value="0">
		<MsgBox Title="Warning" Message="If 1" Type="Warning"/>
	</If>
		<Else>
		<MsgBox Title="Warning" Message="Else 1" Type="Warning"/>
	<If Test="SelectionCount" Mode="Equals" Value="0">
		<MsgBox Title="Warning" Message="If 2" Type="Warning"/>
	</If>
		<Else>
		<MsgBox Title="Warning" Message="Else 2" Type="Warning"/>
	<If Test="SelectionCount" Mode="NotEquals" Value="0">
		<MsgBox Title="Warning" Message="If 3" Type="Warning"/>
		<If Test="SelectionCount" Mode="Equals" Value="0">
		<MsgBox Title="Warning" Message="If 4" Type="Warning"/>
	</If>
	<Else>
		<MsgBox Title="Warning" Message="Else 3" Type="Warning"/>
	</Else>
	</If>
	</Else>
	</Else>
</ytriaAutomation>


XML
<ytriaAutomation>
	<If Test="SelectionCount" Mode="Equals" Value="0">
		<MsgBox Title="Warning" Message="If 1" Type="Warning"/>
	</If>
	<Else>
	<MsgBox Title="Warning" Message="Else 1" Type="Warning"/>
	<If Test="SelectionCount" Mode="Equals" Value="0">
		<MsgBox Title="Warning" Message="If 2" Type="Warning"/>
	</If>
	<Else>
	<MsgBox Title="Warning" Message="Else 2" Type="Warning"/>
	<List name="Doc" Action="Load" Database="AutoTest\lm_us_8.nsf" Server="ytest-MD/TESTING"/>
	<List name="DocA" Action="Load" Database="AutoTest\lm_nab_8.nsf" Server="ytest-MD/TESTING"/>
	<List name="Doc" Action="Load" Database="AutoTest\custinfo_s03.nsf" Server="ytest-MD/TESTING"/>
	<List name="Doc" Action="Load" Database="websecuritystore.ntf" Server="ytest-MD/TESTING"/>
	<List name="Doc" Action="Load" Database="YtriaLogFile-2013-03.nsf" Server="ytest-MD/TESTING"/>
	<Loop List="Doc">
		<If Test="SelectionCount" Mode="Equals" Value="0">
			<MsgBox Title="Warning" Message="If 3" Type="Warning"/>
		</If>
		<Else>
			<MsgBox Title="Warning" Message="Else 3" Type="Warning"/>
		</Else>
	</Loop>
	</Else>
	</Else>
</ytriaAutomation>


automation_IFsub-action_codeblock_1.gif

automation_IFsub-action_codeblock_2.gif