Hmmm... we do it like this and it works.

<property name="report.error" value="false" />
<property name="report.haserror" value="false" />
<foreach item="Line" property="report.line"
in="ValidateAndUpdateSQL-eFinancials2.txt">
<do>
        <property unless="${report.error}" name="report.error"
value="${string::contains(report.line, '&lt;ERROR&gt;')}" />
        <property unless="${report.haserror}" name="report.haserror"
value="${string::contains(report.line, '&lt;ERROR&gt;')}" />
        <echo message="${report.line}" if="${report.error}" />
        <property if="${report.error}" name="report.error" value="${not
string::contains(report.line, '&lt;/ERROR&gt;')}" />
</do>
</foreach>
<fail if="${report.haserror}" />

Not sure why yours doesn't work.

BOb


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael
Jervis
Sent: Tuesday, November 28, 2006 11:42 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] foreach task: Looping over file lines,property
does not extend

I want to loop for each line in a file that has been produced by a
process and echo all lines with 'failed' in them to the email I'm
sending to the developer list:

      <foreach item="Line" in="output.log" property="currentLine">
        <do if="${string::contains(currentLine,'failed')}">
          <echo message="${currentLine}" />
        </do>
      </foreach>

However, on the if clause of the foreach, I get the error that the
currentLine property is not set.

Suggestions?

-- 
Michael Jervis
[EMAIL PROTECTED]
504B03041400000008008F846431E3543A820800000006000000060000007765
62676F642B4F4D4ACF4F0100504B010214001400000008008F846431E3543A82
0800000006000000060000000000000000002000000000000000776562676F64
504B05060000000001000100340000002C0000000000

------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to