[ic] Nested [Loop][List] ? More on Price Tiering...

Kevin Walsh interchange-users@icdevgroup.org
Wed Aug 21 17:21:02 2002


> > Am I doing a no-no here as I've been staring at it for a while now and 
> > I do not see any other problem except that IC may not allow me to 
> > perform prefixed loop searches that are nested...  Can someone confirm 
> > if that is in fact the case?
> >
You can nest [loop] tags, as long as you use a different "prefix" and
"list_prefix" for each [loop].

If you find yourself nesting [loop] tags then you may find it more
efficient to create a single SQL statement that selects everything
in one hit.

> 
> Presuming I was, since I did see in the docs that there were some 
> limitations on nesting but it isn't clear when that may have been 
> removed, I proceeded with another approach and now my eyes are crossing.
> 
> I have this basic loop:
> 
> [loop
>         prefix=FLY
>         search="
>                 fi=tiers
>                 st=db
>                 tf=code
>                 co=yes
>                 rf=tier,quantity,discount
>  
>                 ac=0
>                 sf=tier
>                 op=rm
>                 se=[scratch tier]
>  
> "]
> [list]
> <!-- Tier: [scratch tier], Quantity: [FLY-data tiers quantity], Price: 
> [scratch price], Discount: [FLY-data tiers discount] -->
>                 <tr>
>                   <td align="left">[FLY-data tiers quantity]</td>
>                   <td align="right">[currency][calc][FLY-data tiers 
> discount]*[scratch price][/calc][/currency]</td>
>                 </tr>
> [/list]
> [/loop]
> 
> and it is looping properly for each of the 15 records pulled from the 
> tier table, but the data references are coming up blank.  I have no clue 
> as to why and I've flushed every cache and expired all of the 
> sessions...  I have another very simlilar loop search that work just 
> fine and is almost a mirror of the one above...
> 
You can correct that loop a number of ways.  Here are a couple
of them:

    1) Add "code" to the rf (rf=code,tier,quantity,discount).
       [FLY-data] uses the [FLY-code] as the key, and [FLY-code]
       is the first column in the resultset.

    2) Replace your [FLY-data tiers whatever] tags with
       [FLY-param whatever].  This is the more efficient way of
       doing it; Why force another data lookup when you already
       have the results?

> 
> Am I banging my head against a bug here?
>
Yes - but not an Interchange bug. :-)

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/