Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Getting last dated entry for multiple keys Post Reply Post New Topic
Author Message
joeyg13
Newbie
Newbie
Avatar

Joined: 21 Dec 2010
Online Status: Offline
Posts: 15
Quote joeyg13 Replybullet Topic: Getting last dated entry for multiple keys
    Posted: 24 Jan 2011 at 9:54am
Been perusing the board, but could not find how to accomplish the following:

person_A
  20090101,eventA,result01
  20090302,eventB,result02
  20090401,eventA,result03
  20100101,eventA,result04
  20100102,eventB,result05
  20100113,eventC,result06
  20100113,eventB,result07
  20100113,eventE,result08
person_B
  and their data...

to build to:
the person, then matched pairs of every last dated event with the matching result; note no eventD but some people could have an entry here.

person_A,20100101,result04,20100113,result07,20100113,result06,,,20100113,result08

I know that I will group on the person
and sort on the date field

But stuck on how to set accumulators so that I capture the last dated entry for each event (ok, maybe max value) and it related measure (which would not be the max value).
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 25 Jan 2011 at 3:15am
Personally, I would use a stored proc, put the logic in there to do the matching or to use a middle tier in an application to create the datatable that would be used in the report.
 
Barring that, the next idea is to use subreports, as they will read the data again.  If all the data is in 1 row, the subreport wouldn't be needed, just the logic determine what prints when.
 
If the data looks the sample, an approach might be to use SPLIT() and put it into an array....If the data looks sample, you will probably want to use subreports as you have multiple lines of the report being displayed for a single line of data, which CR will not do without being forced/tricked
 
HTH
IP IP Logged
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.031 seconds.