[ic] list tag in query tag

Ryan Grace interchange-users@icdevgroup.org
Wed Apr 23 14:33:00 2003


Hi All,

I've searched the archives for a clue on this one, but
am coming up blank.  I'm having trouble with a list
within a query tag.

Here's what I'm doing:

[tmp retailer_query]
  select name, street1, street2, city, state, zip,
phone, priority
  from retailer
  where
  [if cgi a]
    phone like '([cgi a])%'
    or phone like '[cgi a]-%'
  [elsif cgi z]
    zip like '[cgi z]%'
  [/elsif]
  [/if]
    and 1=1
  order by priority desc
[/tmp]

which is used in:

[query sql=|[scratch retailer_query]| list=1]
  [no_match]
    <p>There were no retailers found in your area.</p>
    <p>You may [page retailers/index]Go Back[/page]
and try again.</p>
  [/no_match]

  [list]
    <p>[sql-param name]<br>
    [sql-param street1]<br>
    [if sql-param street =~ /\w+/][sql-param
street2]<br>[/if]
    [sql-param city], [sql-param state] [sql-param
zip]<br>
    [sql-param phone]</p>
  [/list]
[/query]

The problem is that the [if] tag for street2 in the
[list] evaluates to true for every list iteration. 
I've also tried this without luck:

[if sql-param street2 !~ /^\s*$/][sql-param
street2]<br>[/if]

Most of the entries returned from the database have a
blank street2 field.  Can anyone see anything
obviously wrong with what I'm doing here?

Thanks much,

Ryan

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com