Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing Rows of Data 1

Status
Not open for further replies.

dmt4cats

Programmer
Jun 26, 2001
15
US
I have a report that includes several rows of data for the same ticket number. I need to compare one field of the data, to see if the 2nd row is the same as the last row, in this one particular field, (the last may be the 10th or the 15th row, no certain number). Is there a way for me to do this comparison?

I am using Seagate Crystal Reports version 8.0

Thank you for any help you can provide.
 
Hi,

There is a way you can tackle this using formulae.

Firstly, group the rows by the ticket number (if you haven't done so already).

Place an initialise formula in the group header:

{@Initialise}
//Start
Numbervar counter:=0;
Stringvar ticket:="";
//End

In the detail section create a formula:

{@Check}
//Start
Numbervar counter:=counter+1;
Stringvar ticket;
Local Stringvar result:="NA";

If counter=2 then ticket:={ticketfield};

If (onlastrecord or {ticketnumber}<>next{ticketnumber})then If counter>2 and ticket:={ticketfield} then result:=&quot;Match&quot;;
result;
//End
 
Thank you very much. I did have the rows grouped by ticket number. I will write the formulas as you have suggested.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top