A completely different way than if/then/else cascades is via defining 
properties and use their values.
1. set a property to the output value if the requirement is true
2. set the properties to empty string (dont forget: props are immutable!)
3. print the properties out

Quick hack without reading the manual carefully :)

<condition property="withTS" value="Gvg-MODULA-Tester">
  <and>
    <contains string="${infomail.lum}" substring="TS" />
    <contains string="${infomail.module}" substring="ModuleA"
casesensitive="false"/>
  </and>
</condition>
<property name="withTS" value=""/>
<echo file="T:\test/infomail_tolist.txt" append="true" message="${withTS}"/>


Jan

> -----Urspr�ngliche Nachricht-----
> Von: Rebhan, Gilbert [mailto:[EMAIL PROTECTED]
> Gesendet am: Montag, 13. Dezember 2004 14:54
> An: ant_user (E-Mail)
> Betreff: ant-contrib <if>
> 
> 
> Hi,
> 
> i have to check a property, if it contains a specific value
> 
> here is my snippet :
> ...
> <if>
>      <and>
>       <!-- checkin whether TS appears in property
>         <contains string="${infomail.lum}" substring="TS" />
>         <contains string="${infomail.module}" 
> substring="ModuleA" casesensitive="false"/>
>      </and>
>         
>      <then>
> <echo file = "T:\test/infomail_tolist.txt" append="true">
> 
> Gvg-MODULA-Tester             <-- only to append if string TS 
> is contained
> Gvg-MODULA-Developer
> </echo>
>       </then>      
> </if>
> <if>
>      <and>
>       <!-- all the other possible values for ${infomail.lum} -->
>         <contains string="${infomail.lum}" substring="T7,TP,DE,PR" />
>         <contains string="${infomail.module}" 
> substring="ModuleA" casesensitive="false"/>
>      </and>
>         
>      <then>
> <echo file = "T:\test/infomail_tolist.txt" append="true">
> Gvg-MODULA-Developer
> </echo>
>       </then>      
> </if> 
> ...
> 
> That works, but i'm looking for a more elegant way.
> Didn't find an example in the ant-contrib docs.
> 
> Any ideas ?
> 
> Gilbert
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to