Page 1 of 1

Category Box

Posted: Tue Jul 20, 2004 3:19 pm
by KMandalia
I have set up several categories in all walk settings. Now in the <summary> function I am printing the category by referencing it as $Category. It always returns the first category even though I change the category via category box.

What am I doing wrong?

Category Box

Posted: Tue Jul 20, 2004 3:52 pm
by mark
In the search form the Category box's input variable name is cq, not Category. That's a number that you need to convert to a name for display.
<sql "select Category from categories where Catno=$cq"></sql>

Category Box

Posted: Tue Jul 20, 2004 4:55 pm
by KMandalia
Well, I do know that. If I change $Category to $cq, it gives me correct category number. I use the sql statement you wrote to get Category corresponding to cq and always get the first category, also the $indexcount doesn't work then.

<b>$start</b> through <b>$end</b> of <b><fmt " %kd " $indexcount></b> records for <b>"$query"</b> on $Category.

Category Box

Posted: Tue Jul 20, 2004 5:11 pm
by mark
Not sure why you would expect more than one category in that case. I would only expect the matching one. Are you saying you're getting the same category no matter what the value of $cq is?

In general to print all values of a vortex variable you need to loop over it:
<loop $Category>
$Category
</loop>

By doing your sql inside the main sql you've lost indexcount. Do your sql before the main search sql and save the result in another variable for use later in the summary function.

Category Box

Posted: Tue Jul 20, 2004 5:30 pm
by KMandalia
Thanks for your help. I got it.