[ic] if tag weird behavior

Mike Heins mike at perusion.com
Sun Oct 28 16:01:44 EST 2007

Quoting Ton Verhagen (tverhagen at alamerce.nl):
> Quoting Mike Heins <mike at perusion.com> :
> >Explicit is intended to have valid code as it's test, and a literal like
> >that has undetermined behavior when interpreted as Perl code.
> >
> >Why you would do that instead of:
> >
> >        [if scratch test_value]
> >        foo
> >        [/if]
> Because I simplified the code a bit.
> I am actually testing if a control of a component contains a value or not.
> And as far as I am aware of, there is no [if control test_value] 
> available in IC.
> I had something like below in a modified random component:
> [loop serach=|
>         fi=products
>         st=db
> [if type=explicit condition="[control brand]"]
>         sf=brand
>         se=[control brand]
>         op=eq
> [else]
>         ra=yes
> [/else]
> [/if]
> |]
>         do something
> [/loop]
> Everything seemed to work well until we discovered that for
> brand=00000159 no proper results were returned.

You just can't do it. You need to give valid code, not an unquoted
literal. You can do:

[if type=explicit condition="'[control brand]'"]
        se=[control brand]

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

Few blame themselves until they have exhausted all other possibilities.
 -- anonymous

More information about the interchange-users mailing list