Print Page | Close Window

Next() function in the group

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=355
Printed Date: 03 May 2025 at 2:15pm


Topic: Next() function in the group
Posted By: aleplgr
Subject: Next() function in the group
Date Posted: 19 Mar 2007 at 10:34am
Hi, I have a table with 3 columns: ClientID, Date1 and Date2 grouped by ClientId,  and I need to calculate the difference: Date1 - Next(Date2) .
Works fine using the Next() function but the problem is that the Next() function just takes the Next record no matter if it is in the same group or not, so I have problems when the group has just one row and in the last row of all the groups. How could I control that the Next() function selects the next in the SAME group?
Is there a way to notice that one record is the last of the group?
Thanks in advance



Replies:
Posted By: BrianBischof
Date Posted: 19 Mar 2007 at 3:38pm
You're going to have to modify the formula to also look at the current group name and compare it to the Next() group field name.  Only perform the date calculation when they are different.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: aleplgr
Date Posted: 20 Mar 2007 at 1:23am

LOL yes, thanks, now I've got a NumberVar IdClient for the actual group and when it changes I know that I'm in the next group




Print Page | Close Window