Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [jiliu] merging records

Quote Reply
Re: [jiliu] merging records In reply to
Hi,

Follow the steps below:

- Create a group_data subroutine in Global template:
sub {
my $tags = shift;
my $results = $tags->{results};
my $col = $tags->{column};
($results) or return;
my $last_val;
foreach (@$results) {
if(not defined $last_val or $last_val ne $_->{$col}) {
$_->{group} = 1;
$last_val = $_->{$col};
}
}
}

- Modify your search_results.html like:
.....
<%set column = 'group_field_name'%>
<%group_data%>
<%loop results%>
<%if group%><b><%group_field_name%></b><%endif%>
<%field2%>.....
<%endloop%>
.....

Cheers,

TheStone.

B.

Last edited by:

TheStone: Jan 11, 2002, 5:53 PM
Subject Author Views Date
Thread merging records jiliu 2692 Jan 11, 2002, 9:16 AM
Thread Re: [jiliu] merging records
604 2645 Jan 11, 2002, 5:53 PM
Thread Re: [TheStone] merging records
jiliu 2635 Jan 12, 2002, 12:40 PM
Post Re: [jiliu] merging records
604 2621 Jan 14, 2002, 11:08 AM