Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Previous/Next Function Post Reply Post New Topic
Author Message
chris
Newbie
Newbie


Joined: 02 Apr 2008
Location: United Kingdom
Online Status: Offline
Posts: 35
Quote chris Replybullet Topic: Previous/Next Function
     Posted: 19 May 2009 at 3:25am
Hi all,
 
I have been using the previous/next functions in my report to allow me to compare dates on different detail rows.
 
However, I noticed on my report that the next/previous function does not seem to stop at the last detail row of the group. i.e the next function in the last line of a group is taking data from the first line of the next group.
 
Is there anyway to stop this from happening ?
 
Many Thanks
 
Chris 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 May 2009 at 6:54am
I haven't use previous and next, but I am guessing that you will need to check the grouping criteria in your formula so that you don't get erroneous results.
 
I am also guessing, that Crystal doesn't really care about the group criteria...if the report writer wanted to use previous and next, then, we will just do as they say.  It probably allows for some really flexible reports, but in this case is causing a headache instead.
IP IP Logged
STOuser
Newbie
Newbie


Joined: 01 Dec 2009
Location: United States
Online Status: Offline
Posts: 1
Quote STOuser Replybullet Posted: 01 Dec 2009 at 12:09pm
I am having the same problem that you posted regarding the previous/next function not stopping at the end of the group.  Did you get an answer to the issue? 

Thank
Linda
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Dec 2009 at 1:17pm

Depends on what you want it to display on the last record or first record but the idea is to add an if then to your formula using onfirstrecord or onlastrecord.

An example to display 0 days on the last row:
if onlastrecord then 0 else datediff('d',next(datefield),datefield)
 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum