Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: first and last records Post Reply Post New Topic
Page  of 2 Next >>
Author Message
dashamit
Newbie
Newbie


Joined: 11 May 2011
Location: United States
Online Status: Offline
Posts: 7
Quote dashamit Replybullet Topic: first and last records
    Posted: 11 May 2011 at 5:40am
Hi Friends, How to get the first and last records from each unsorted groups in crystal reports?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 May 2011 at 5:45am
for display purposes only just move the fields you want to see into the GHeader (first record) and GFooter (last record)
IP IP Logged
dashamit
Newbie
Newbie


Joined: 11 May 2011
Location: United States
Online Status: Offline
Posts: 7
Quote dashamit Replybullet Posted: 11 May 2011 at 7:30am

But what is the method to identify the first and last values of individual field.

My requirement here is to show the First and last fields as summary.
For example
 
       DescColumn   ColumnA-First   ColumnB-Last
   GroupA
           A                        5                        3
           A                        8                        9
           A                        4                        1
      ----------------------------------------------------------
   Summary                                           1
   GroupB
           B                        7                        2
           B                        3                        9
           B                        6                        6
      ----------------------------------------------------------
   Summary                    7                        6
 
 


Edited by dashamit - 11 May 2011 at 7:31am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 May 2011 at 7:48am

again for just display purposes

make 2 running totals
name=First
field to summarize=column A
type of summary=SUM (assuming these are numeric fields)
Evaluate = On change of group (wahtever your grouping is)
Reset =On change of Group (same group as above)
 
Name=last
field to summarize=column b field
type= sum
evaluate = use a formula
next(descfield) <> descfield or onlastrecord
reset=on change of group
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 May 2011 at 7:48am
both RTs have to be placed in the group footer to display correctly
IP IP Logged
dashamit
Newbie
Newbie


Joined: 11 May 2011
Location: United States
Online Status: Offline
Posts: 7
Quote dashamit Replybullet Posted: 11 May 2011 at 8:46am
 Hi, managed to get the last values using the below formula.
  if({colB}<>previous({colB})) then {colB}
 
Could you please explain a bit more on getting the first value, (ColumnA in the example).
 
"name=First
field to summarize=column A
type of summary=SUM (assuming these are numeric fields)
Evaluate = On change of group (wahtever your grouping is)
Reset =On change of Group (same group as above)"
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 May 2011 at 8:51am
in the Field Explorer fine 'Running Total Fields'
Right click on it and select NEW
a window opens up
RT name =FIrst value (or whateer you want)
field to summarize = select the column A field for this
Type of SUmmary = select SUM
Evaluate section
select On change Of Group toggle option and then in the pick list sleect the group name here
Reset section
select On change Of Group toggle option and then in the pick list sleect the group name here

Save it.
Drag it and drop it on the group footer
 
IP IP Logged
dashamit
Newbie
Newbie


Joined: 11 May 2011
Location: United States
Online Status: Offline
Posts: 7
Quote dashamit Replybullet Posted: 11 May 2011 at 9:39am
Thanks a lot DBlank!!! You made my Day today...
Looking forward to create and add the running totals fields using Java Sdk. It will helpful if you have some sample code on this.


Edited by dashamit - 11 May 2011 at 9:40am
IP IP Logged
Farhan
Newbie
Newbie


Joined: 13 Jun 2012
Location: Denmark
Online Status: Offline
Posts: 3
Quote Farhan Replybullet Posted: 13 Jun 2012 at 11:16pm
Thanks

dear I applied same logic its working perfectly but i cannot access last record of report. it works on all records and group change but not on lastrecord of report. please guide me
IP IP Logged
Farhan
Newbie
Newbie


Joined: 13 Jun 2012
Location: Denmark
Online Status: Offline
Posts: 3
Quote Farhan Replybullet Posted: 13 Jun 2012 at 11:18pm
For example
 
       DescColumn   ColumnA-First   ColumnB-Last
   GroupA
           A                        5                        3
           A                        8                        9
           A                        4                        1
      ----------------------------------------------------------
   Summary                                           1
   GroupB
           B                        7                        2
           B                        3                        9
           B                        6                        6
      ----------------------------------------------------------
   Summary                    7                    (cant see 6 here)
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.