[ic] sql query results problem

Aaron Hazelton interchange-users@icdevgroup.org
Thu Sep 19 08:35:02 2002


 Andrei Gologan wrote:
> 
> Hallo,
> 
> the code I use is down the page. The problem I have is when 
> there is no row
> in the table menge, meaning the query should be empty there is nothing
> displayed. I thought [no_match] would work but it doesnt. I 
> use IC 4.8.3.
> If there is a row returned (this means data is entered for a 
> user - sku
> combination) it works. Am I doing sth wrong ?
> 
> What do I need to do to get it working if sql query is empty 
> - no data in
> the table fpr the user, sku combination ?
> 

I just ran into this problem recently, and found that Jeff Dafoe
posted the solution to this problem in the online docs, you
can see it here:
http://www.icdevgroup.org/cgi-bin/ic/docfly.html?mv_arg=ictags04%2e55

> 
> [query type=list list=1 sql="SELECT quantity FROM menge WHERE
> username='[data session username]' AND sku='[item-code]'"]
> 
> [on_match]
>     [if type=explicit compare="[calc][sql-param quantity] > 0 
> [/calc]"]
>          <font __FFACE__ size="1" color="#008000"><b> [sql-param
> quantity]</b></font>
>     [else]
>         <font color=red>No</font>
>     [/else]
>     [/if]
> [/on_match]
> 
> [no_match]
>     <font color=red>No</font>
> [/no_match]


try changing to this:
  [no_match]
  [list][/list]
  <no match code>
  [/no_match]

and it should work.


> 
> [/query]
> 
> Thank you
> Andrei
> 

Thanks,
Aaron