[rt-users] Getting current record number in report using Weekly.html

darren chamberlain darren at boston.com
Tue Feb 18 13:03:46 EST 2003


* Tom Lichti <tom at redpepperracing.com> [2003-02-18 12:23]:
> I need to get the current record number, since I want to do something
> different for the first record, versus the rest

[-- snip --]

> The area of code I am looking at is here:
> %while (my $trans = $transes->Next) {
> % if ($trans->Type =~ /Create|Comment|Correspond/) {
> <%$transes->Count%>
> <br>
> <%$trans->Created%> <%$trans->Type%> by: <%$trans->CreatorObj->RealName%>
> <blockquote>
> <pre><%$trans->Content%></pre>
> </blockquote>
> % }
> % }

Try something like:

% my $transaction_number = 1;
% while (my $trans = $transes->Next) {
%   if ($transaction_number == 1) {
%       # Do you first transaction stuff
%   }
%   $transaction_number++;
%   if ($trans->Type =~ /Create|Comment|Correspond/) {
<%$transes->Count%>
<br>
<%$trans->Created%> <%$trans->Type%> by: <%$trans->CreatorObj->RealName%>
<blockquote>
<pre><%$trans->Content%></pre>
</blockquote>
%   }
% }

$transaction_number is 1 only the first time through.

(darren)

-- 
Your only obligation in any lifetime is to be true to yourself.  Being
true to anyone else or anything else is ... impossible.
    -- Richard Bach



More information about the rt-users mailing list