Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Using Next values in current record Post Reply Post New Topic
Author Message
GowthamSen
Groupie
Groupie


Joined: 03 Jun 2009
Location: India
Online Status: Offline
Posts: 65
Quote GowthamSen Replybullet Topic: Using Next values in current record
     Posted: 30 Oct 2009 at 2:11pm
Hi,
 
I have a scenario that, I should use a value of a column in the next coming records in current record.
 
The data is as follows.
 
ORDER   LINE    Q1 Q2   WEEK-NUM   FINAL_QTY ( Final Qty of Week(i) = Q1 (week i+1) - Q2 (week i+2))
-------------------------------------------------
100        1         10   02     1               8  ( 30 - 22 = 8) 
100        1         10   02     1               8  ( 30 - 22 = 8) 
100        1         30   22     2               7  ( 10 - 3 = 7)
100        1         10   3       3               7
100        1         10   3       3               7
100        1         10   3       3               7
 
Here the column FINAL_QTY is calculated as follows.
 
FINAL_QTY of Week i = Q1 of Week i+1 - Q2 of week i+1
 
For example:  First 2 records belong to week 1.
 
The value of FINAL_QYT for week 1 =  Q1 of week 2 - Q2 of week 3.
Now the value = 30 - 22 = 8.
 
For the last week the calculation = Q1 of current week - Q2 of current week.
 
Is there any way we can do this in crystal reports?
 
Thanks in advance.
 
Regards
Gowtham
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 Nov 2009 at 6:23am
create a stored proc and do it there.  next and previous are pretty limited, the most versatility is gained by using stored procs.
IP IP Logged
GowthamSen
Groupie
Groupie


Joined: 03 Jun 2009
Location: India
Online Status: Offline
Posts: 65
Quote GowthamSen Replybullet Posted: 03 Nov 2009 at 8:25am
Thanks Lockwelle.
 
I am  using Progress Database .. and I don't have access to the database. So I am looking for some workaround in reporting tool itself.
 
Can we do something like this in report level?
 
Thank you
Regards,
 
Gowtham
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Nov 2009 at 6:12am
probably not.  CR really looks at a the data in a row by row fashion. To ask it to look more than 1 record in either direction, using native calls is not possible.  You would have to figure out a subreport or someother function that would return the data that you are looking for, and obviously since you will need to read the data at least twice, you are looking at a performance hit to the report, unless your dataset is small.
 
You are asking to perform more of a programming function, and you probably noticed that CR is not really a programming tool, it basically reads data 1 line at a time and displays it. (I realize that this is not entirely true as it needs to read the data and apply formulae that might be used in group, or just to group and sort the data as dictated by a report.)
 
HTH
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