[ic] loop-last question

Grant listbox at email.com
Tue Oct 14 09:15:02 EDT 2003


> Grant <listbox at email.com> wrote:
> >> Thanks Chris.  I didn't know what loop-increment was.  Time to
> >> get rid of my
> >> counters.  Thanks to your help I've got loop-last doing what I need.
> >> But I'm wondering if there's a way to use it without calc.  Here's
> >> an example that works with calc:
> >>
> >> [loop search="ml=10000/ra=yes"]
> >> code: [loop-code]<br />
> >> 	[loop-last][calc] return '[loop-code]' eq 'sku-20';
> >> [/calc][/loop-last] [/loop]
> >>
> >> How could it be written without calc?
> >>
> >> - Grant
> >
> > Can loop-last be used without calc?  I'm asking because I'm under the
> > impression that calling calc or perl results in a performance hit.
> >
> > - Grant
> >
>
> http://www.icdevgroup.org/i/dev/docfly.html?mv_arg=ictemplates05%2e04
>
>
> [loop-last]tags[/loop-last]
>
> Evaluates the output of the ITL tags encased in the [loop-last]
> tags. If it
> evaluates to a numerical non-zero number (for example, 1, 23, or
> -1), the loop
> iteration will terminate. If the evaluated number is negative,
> the item itself
> will be skipped. If the evaluated number is positive, the item
> itself will be
> shown, but will be last on the list.
>
>
> Paul

I've been over and over those docs, and what I thought after reading them
was that something like [loop-last]1[/loop-last] inside a conditional
statement would terminate the loop once the condition was met.  After some
testing and some info from the list, it seems like it just doesn't work like
that.  [loop-last]1[/loop-last] must be parsed if it exists in a loop
whether or not that particular line is being executed.  I hope I'm making
sense.  Taking all of that into account, I don't think there is a way to use
loop-last without calc or perl.  Is there?

- Grant



More information about the interchange-users mailing list