Forum OpenACS Q&A: Inline TCL inside the <multiple> tag

Collapse
Posted by Daniel Comer on
Hi,
This is the first time ever posting to this site.  Im fairly new with this technology and am in DIRE need for some help here.

I am doing a multirow select statement in the tcl and displaying the results with the <multiple> tag.  I am selecting out of a database some country information where country = Country1 or country = Country2 or country = Country3.

lets say for example, I get six results, 2 for each country.  What I need to do, is display the country name as a header above each country, then list the countrys results under the header.  So, I would have three country headers with 2 results under each header.  The problem is... the way I am trying to do this now is I have a current country variable and last country variable.  The logic of what I want to do is... only display the current country variable if it is not equal to the last country variable.  If the current country is equal to the last country, do not display a header, if the current country is not equal to the last country, then display the header.

so.... through each iteration of the rows in the <multiple> tag, I want to:
<%= [set lastcountry $currentcountry] %>

this code works outside of the <multiple> tag, but when I put it inside the <multiple> tag it is just displaying
= [set lastcountry $currentcountry]

for each iteration inside the loop.  Any ideas on what I need to do?

Collapse
Posted by Jade Rubick on
Hi Daniel, and welcome to OpenACS!

I think there's an easier way of doing what you'd like to do. Look at the <group> tag. At least if I'm understanding what you're trying to do.

Also, I would have a look at my templating doc, at http://rubick.com/openacs

Consider joining us on IRC. Or posting back here if that doesn't help.

Collapse
Posted by Daniel Comer on
well... to give a little more information on my situation.

view:
http://www.curvesinternational.com/isthereacurvesnearme_new

in the "Outside the US and Canada" drop down list, here is what needs to be done.  If you choose any country other than Caribbean, then it only return one country, which is what this entire page has been built upon (one country returned).  My client wants multiple country's to be returned for Caribbean however, instead of listing out every country from teh Caribbean in the drop down.  so, I have to keep it within the <multiple> tag to avoid redesignin most of the site.  I can say if the country is caribbean, then have a seperate select statement for each country that is in the Caribbean, however, I was just hoping there was a slicker, more intuitive way to do this.  Mainly, I am curious as to why inline tcl is not running correctly within the <multiple> tag.

Thanks

Daniel

Collapse
Posted by Jade Rubick on
I don't know, maybe someone else can answer this.

But I do suggest looking at this:

https://openacs.org/doc/acs-templating/tagref/group.html

It may solve your problem, and it doesn't require a rewrite of your <multiple> section, just adding in a section for the grouped areas.

Collapse
Posted by Daniel Comer on
That is exactly what I needed.

Thank you so much for your help, you saved me a lot of heartache =).

btw, the link you gave me earlier was broken.

Thanks again