[ic] [if] [/if] inside loop list

Michelle Wilant interchange-users@interchange.redhat.com
Fri Jan 11 11:40:01 2002


I just spent what felt like forever trying to figure this out myself.  I finally had a
breakthough.  If you want to do some basic perl if statements within your loop or list tags,
use:

[if-sql-field <query field here> <operator> <towhat>]
and end the if loop with:
[/if-sql-field]

for example:
[if-sql-field sku != "5555"]
    ...then do...
[/if-sql-field]

It took me a while to find this.  It would be nice to - in the future - have this documented
under the [if] documentation in the books and online docs, or some reference or pointer
saying something to the effect of using if on query results.

Salvador Caballe wrote:

> I need to include a [if] [/if] inside loop list in the order_detail.html page.
>
> somethink like this:
>
> loop list="[scratch arg]"]
> <TABLE BORDER=0>
> [html-table fr='class="contentbar1"']
>         <B>ORDER NUMBER [scratch arg]
>         .......
>         ......
>         <B>Payment Method       [if  [loop-data transactions payment_method] eq COD] Cash
> on delivery  [else] loop-data transactions payment_method] [/else][/if]
>
> I found [if-loop-data database fieldname] but only checks if it exists.
>
> best regards
> Salvador Caballé
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users