Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Problem with foreach

This loop is supposed to find the two most recent articles (save for those articles called "mainpage") in all sub-directories of a main directory named "bereiche":

{$foreach 2 newart in (and(folder "bereiche/*")(not(filename "mainpage"))) sortDescendBy .fileddate $}

What it does instead is, when there are copies of one article (copy and paste) in any subdirectory, that it lists ALL those copied articles - instead of limiting itself to two articles in total.

Whats wrong ? Getting tired by now :-) Any hint appreciated.

Patrick

Patrick Thomas
Tuesday, November 25, 2003

Sorted out, thanks Mike! The special case is that the "sort" finds "unsortables" (identical article copies) and will not let itself be bullied by a "top 2" restraint on those it considers equal.

Anyway, article copies done for testing only. Works in all other "practical" circumstances (non-identical articles).

Patrick

Patrick Thomas
Tuesday, November 25, 2003

*  Recent Topics

*  Fog Creek Home