Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Selecting last records using param Post Reply Post New Topic
Page  of 2 Next >>
Author Message
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Topic: Selecting last records using param
    Posted: 22 Jan 2013 at 10:06am
I have a report that is pulling Operator ID's, names and time stamps of jobs from a database. I want to display only the last so many reords determined by a paramater. I have a parameter set as a number and I have tried using it in a select statement but I have not been able to get anything to work. 
 
Thanks for the help
Kev V. 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Jan 2013 at 10:23am
do you mean you want ot display only the last timestamp in a parameter?
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 22 Jan 2013 at 10:25am

I want to show the whole record. So say there are 100 records I only want to display the last 20 records. So I would enter 20 for the parameter value when prompted. So Iguess you could say the last 20 timestamps.

 
KevV


Edited by KevV - 22 Jan 2013 at 10:27am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Jan 2013 at 10:32am
make a numeric param
group on the operator
sort descending on the timestamp
add a running total
name=counter
field to summarize=any field that doe snot have nulls
type = count
evaluate=for each record
reset= on change of group (operator)
 
conditionally suppress the detail section as
{#counter}>{?param}
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 22 Jan 2013 at 10:41am
That shows me the last 20 of each operator. I need it to show the last 20 total.
 
KevV
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Jan 2013 at 10:42am
then do not group and make the RT reset=never
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 22 Jan 2013 at 10:44am
That did it. Thanks a bunch.
 
KevV
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 23 Jan 2013 at 5:33am
I though it was all good. It runs fine but they have another field that is a location and they want it to sort by the location. If I use that in the sorting it looks at the highest 20 locations.
KevV
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Jan 2013 at 7:25am
if you used a command object to select the top 20 then you can sort those by any way you want.
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 23 Jan 2013 at 8:01am
I am not quite sure on the command object.
 
KevV
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.031 seconds.