Hi friends,
I'm new to this mail group and also new to ant script.
I have a problem while using foreach in ant.  Im having ant 1.5.3 version. 


The following is the script 

        <target name="wsc.MessagingBridges.create">
                <var name="i" value="0" unset ="true"/>
                <var name="j" value="1" unset ="true"/>
                        <echo>The loop starting ${i} ${j}</echo>
                        <forEach list="${JMSBridgeDest_Nos}" 
 target="wsc.MessagingBridge.create" 
 param="JMSBridgeDest_Nr" 
 inheritall="true"/>
                <echo>For Loop ends</echo>
        </target>

        <target name="wsc.MessagingBridge.create">
                <echo>Creating Bridge </echo>
                <echo>${i} ${j}</echo>
                <math result="jdb_src1" operand1="${JMSBridge}" 
operand2="${i}" operation="+" datatype="int"/>
                <math result="jdb_src2" operand1="${JMSBridge}" 
operand2="${j}" operation="+" datatype="int"/>
                <echo>${JMSBridge_Nr} ${jdb_src1} ${jdb_src2}</echo>
                <propertycopy name="JMSBridge" 
from="JMSBridge${JMSBridge_Nr}" silent="false"/>
                <propertycopy name="jbd_source1" 
from="JMSBridgeDestName${jdb_src1}" silent="false"/>
                <propertycopy name="jbd_source2" 
from="JMSBridgeDestName${jdb_src2}" silent="false"/>
                <propertycopy name="DestJNDIName" 
from="DestJNDIName${JMSBridge}" silent="false"/>
        <echo>Finished Bridge.</echo>
        <math result="i" operand1="${i}" operand2="1" operation="+" 
datatype="int"/>
        <math result="j" operand1="${j}" operand2="1" operation="+" 
datatype="int"/>
        <echo> ${i} ${j}</echo>
        </target>

    The value of JMSBridgeDest_Nos which I'm loading from a properties 
file contains 1,2. I want the target "wsc.MessagingBridge.create" to 
iterate twice. The iteration is working fine. I'm having another 2 
variables i and j which I want ed to increment and to passed to target 
"wsc.MessagingBridge.create" in each iteration. I tried the above code but 
the values of i and j never changes. 
  Can anyone help me regarding this. 
    In each iteration I want the value of i and j to be dependant on 
"JMSBridgeDest_Nr". 
For eg. 
if JMSBridgeDest_Nr = 1 then i = 1 and j =2
if JMSBridgeDest_Nr = 2 then i = 3 and j = 4

Thanks in advance.

Abdul K Jameel
Tata Consultancy Services Limited
Mailto: [EMAIL PROTECTED]
Website: http://www.tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


Reply via email to