[Catalyst] iterating twice over the same resultset in thetemplate?
Fernan Aguero
fernan at iib.unsam.edu.ar
Thu Jan 4 13:28:19 GMT 2007
+----[ Brian Kirkbride <brian.kirkbride at deeperbydesign.com> (03.Jan.2007 17:16):
|
[snipped]
| >The problem is that the resultset is empty when I try to
| >iterate over it the second time.
| >
| >So far the only way I've found to make this work is
| >to do N separate searches, fill N stash elements, et cetera
| >
| >$rs1 = $model->search( ... ); $c->stash->{rs1} = $rs1;
| >$rs2 = $model->search( ... ); $c->stash->{rs2} = $rs2;
| >...
| >
| >[% WHILE ( it = rs1.next() ) -%] ...
| >[% WHILE ( it = rs2.next() ) -%] ...
[snipped]
| You want rs.reset() between the iterations IIRC.
|
+----]
Thanks to all who replied. rs.reset() did it. It completely
escaped me when I read the Resultset.pm POD.
Fernan
More information about the Catalyst
mailing list