foreach

Description

A job which executes its child jobs for each of the provided values. The child job can access the current value using the psudo property 'current' to gain access to the current value. The psudo property 'index' is also available.

The return state of this job depends on the return state of the children (like sequential). Hard resetting this job will cause the children to be destroyed and recreated on the next run (with possibly new values). Soft resetting this job will reset the children but when re-run will not reconfigure the values.

Properties

NameDescriptionRequired
name A name, can be any text. No.
values Any value. No.
current The current value R/O.
index The current index in the values. R/O.
loadOnly If true this job will only load the child jobs for each value - it will not run them. Useful for testing scripts. No.

Elements

child

Required: Yes.

The child to execute for each type.

Example


 <oddjob id="this">
   <foreach id="copy-reps">
     <values>
       <file file="${this.dir}/data/demo1.rep"/>
       <file file="${this.dir}/data/demo2.rep"/>
       <file file="${this.dir}/data/demo3.rep"/>
     </values>
     <child>
       <copy from="${copy-reps.current}" 
                to="${this.dir}/work"/>
     </child>
   </foreach>
 </oddjob>
 


(c) Rob Gordon 2005