Home
The Toolkit for Online Communities
17453 Community Members, 1 member online, 621 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : FYI: Group tag fix

Forum OpenACS Development: FYI: Group tag fix

Icon of envelope Request notifications

Collapse
Posted by Lars Pind on
I've added a new feature to the group tag, which is a pseudo-column called 'groupnum_last_p', which will be set to 1 in the last row inside a group tag.

This is useful if you want to output your group elements like this:

<multiple name="shirts">
  <p>
    @shirts.style@ - choose
    <group column="style">
      @shirts.color@
      <if @shirts.groupnum_last_p@ false>, </if>
      <else>, or </if>
    </group>
  </p>
</multiple>

While doing this, I found an undocumented feature, namely the pseudocolumn 'groupnum', which will return 1 for the first row inside the group tag, then 2, 3, etc.

I also found out, however, that the 'groupnum' pseudocolumn doesn't work properly inside nested group tags. So I fixed that problem.

But it's nearly impossible to get the groupnum_last_p feature to work propely inside nested group tags, so I left that as a documented 'feature'.

It'll be committed to the 4.6 branch along with our other changes, as well as workflow and the new and improved bug-tracker/ticket-tracker.

Enjoy!

/Lars

Collapse
2: Re: FYI: Group tag fix (response to 1)
Posted by Mark Aufflick on
That's really cool - great bug fixing Lars ;)
Collapse
3: Re: FYI: Group tag fix (response to 1)
Posted by Poonam Gandhi on
Hi All,
I have just recently started working with OpenACS and I am facing a problem while using group tag.
Actually group has "All" the rows grouped by the specified column but my requirement is to get first "n" row from that. For this I am using multiple tag "x" and a group tag on col "y" inside that multiple. So my terminating condition becomes something like
if @x.groupnum@ le n
do something
else
break
but this is not working

Could anybody help please

Thanks,
Poonam

Collapse
4: Re: FYI: Group tag fix (response to 1)
Posted by Dave Bauer on
This is the correct behavior of the group tag. It doesn't hide rows.

You can do this yourself.

<multiple name="foo">
<group column="bar">
<if @foo.groupnum@ eq 1>
do something
</if>
</group>
</multiple>