[ic] sql query results problem

Aaron Hazelton interchange-users@icdevgroup.org
Thu Sep 19 09:11:01 2002


Andrei Gologan wrote:
> > 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.
> >
> 
> I changed it, but it doesnt do anything  better .....
> 
> do i need to have ic 4.8.6 ? or it would also work with 4.8.3 ?
> 

it works in 4.8.3, im using it on a production site.

> how else can I check if there is data in the row and if not 
> print the <no
> match code> ???
> 

don't you need [list] in the [on_match] ?

> 
> Thank you
> Andrei
> 

Aaron