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">
<module name="Main" dependsOn="First,Second">
<![CDATA[Main module printing]]>
<module name="First" if="FirstOrSecond eq 1">
<![CDATA[First half printing]]>
<module name="Second" if="FirstOrSecond eq 2">
<![CDATA[Second half printing]]>
<variable name="FirstOrSecond" value="1" />
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.