Multiple modules conditionally executed per variable value
Multiple modules conditionally executed per variable value
When GoAnywhere executes this project by default it will begin with the Main module. On the Main module I've added a couple modules to the Depends On attribute which are separated by a comma. Since the Main module depends on First and Second to run it will then pass control to the First module. I added a Execute Only If condition on that module to say to run only when the variable is set to a 1. I've also added conditional logic to the Second module to run only if it's a 2.
In the example below the "First" module will execute because the variable is set to a 1. The "Second" module will be skipped and then the "Main" module will finish execution. For demonstration purposes each module only prints some static text.
- Code: Select all
<project name="Multiple Modules" mainModule="Main" version="1.0">
<description></description>
<module name="Main" dependsOn="First,Second">
<print>
<![CDATA[Main module printing]]>
</print>
</module>
<module name="First" if="FirstOrSecond eq 1">
<print>
<![CDATA[First half printing]]>
</print>
</module>
<module name="Second" if="FirstOrSecond eq 2">
<print>
<![CDATA[Second half printing]]>
</print>
</module>
<variable name="FirstOrSecond" value="1" />
</project>
With this in place I can easily override the project variable at run time (via GoAnywhere's scheduler, Execute Advanced screen, RUNPROJECT command, etc) and determine what tasks will be executed.
- Support_Steve
- Support Specialist
- Posts: 13
- Joined: Fri May 08, 2009 7:59 am
Who is online
Users browsing this forum: No registered users and 0 guests