[ic] loop-last based on a scratch value

Mike Heins mike at perusion.com
Fri Nov 7 15:57:39 EST 2003


Quoting Ed LaFrance (edl at newmediaems.com):
> At 11:14 AM 11/7/2003 -0800, you wrote:
> 
> >> > > The following doesn't work.  Is it a syntax problem, or is a
> >> loop-last
> >> > based
> >> > > on a scratch value just not going to happen?
> >> > >
> >> > > [loop-last][loop-calc] return 1 if $Scratch->{listing_counter} == 4;
> >> > > [/loop-calc][/loop-last]
> >> >
> >> >I think it is pretty obvious from the documentation that you need the
> >> >regular calc tag inside of the loop-last.
> >> >
> >> >Bye
> >> >         Racke
> >>
> >> Stefan is quite right, so to correct my earlier answer:
> >>
> >> [loop-last][calc] return 1 if $Scratch->{listing_counter} == 4; return 0;
> >> [/calc][/loop-last]
> >>
> >> http://www.icdevgroup.org/i/dev/docfly.html?mv_arg=ictags04.44
> >>
> >> - Ed
> >
> >I tried all kinds of things before my first message to the list about this.
> >Using your suggestion above, I just tried this:
> >
> >[loop list="1 2 3 4 5 6 7 8 9"]
> >[tmp listing_counter][calc] [scratch listing_counter] + 1 [/calc][/tmp]
> >[loop-last][calc] return 1 if $Scratch->{listing_counter} > 1; return 0;
> >[/calc][/loop-last]
> >[loop-code] - [scratch listing_counter]
> >[/loop]
> >
> >and it iterates all 9 times.
> >
> >- Grant
> 
> See yesterday's message on interpolation order; nothing happens with 
> [scratch listing_counter] in your code until all [loop]'ing is done. Try 
> something like this instead:
> 
> [set listing_counter][/set]
> [loop list="1 2 3 4 5 6 7 8 9"]
> [loop-last][calc]return 1 if ++$Scratch->{listing_counter} > 1; return 
> 0;[/calc][/loop-last]
> [loop-code] - [scratch listing_counter]
> [/loop]

Actually in this case it does. Part of the deal with [loop-last] is that
it does interpolate contained ITL.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295      <mike at perusion.com>

My wife is great.  She doesn't care where I go, just as long as I don't
have any fun.  -- Lee Trevino


More information about the interchange-users mailing list