[ic] mv_search_match_count behavior

Mike Heins interchange-users@interchange.redhat.com
Sat Jan 5 14:56:00 2002


Quoting JT Justman (jt@signless.com):
> Hi! Using IC 4.8.3. I have an SQL list:
> 
>  [query sql="select sku, title, sold, short_description, price, size_desc,
> color, style_category, type_category from products
>                where [scratch cat_type]_category='[scratch cat_number]';"
>          type=list
>          more=1
>            ml=10]
> 
> that works fine. At the top of the results, I use the following code:
> 
> [on_match][value mv_search_match_count] total items in this category.
> <BR>Pages:      [more_list]
>         [more]
>       [/more_list]<BR>
> 
>         <table width="80%" border="0" cellspacing="0" cellpadding="2"
> align="center">
> [/on-match]
> 
> [list]
> ...
> 
> The problem is that mv_search_match_count always returns the value of
> the -last- search. For example, if I start out with a blank session, it
> returns nothing. Reloading the page, going to the next [more] page or going
> to another category (different query) changes it to the number of results in
> category 1. Category 3 will display the number of results in category 2 etc.
> Is this strange, or do I misunderstand how this is supposed to behave? If
> this is so, how can I display the number of results in the current query?
> 

The mv_search_match_count does not apply to the query tag unless it
is a non-SQL database, since no Interchange search has been done.

As for solutions, I don't really have any other than to repeat
the query with a "select count(*) from ....".

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

"Even if you're on the right track, you'll get run over if you just
sit there." -- Will Rogers