Print Page | Close Window

Select first row of customer data

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22570
Printed Date: 01 May 2024 at 4:01pm


Topic: Select first row of customer data
Posted By: SNelson
Subject: Select first row of customer data
Date Posted: 06 Apr 2018 at 7:03am
Is there a way to select only the first row of customer data? Using the Select Expert? I have tried identifying the first row using the Running Total command. It works to give me an accurate count of rows for each customer but this field is not an option in the Select Expert. I have also tried creating a number variable from the value in the running total field but again can't use it in Select Expert. Thanks for any help!

-------------
SNelson



Replies:
Posted By: kevlray
Date Posted: 09 Apr 2018 at 4:32am
Nothing in the select expert would really work.  If you are grouping, you should be able to select the top 1 record (provided you have a summary for the group).  It is under Group Sort Expert.  I have only used a few times.

Other ways that might work for you.  Creating SQL (in a command) using the top x command.  Putting your details in the either a Group Header or Group Footer (depending on how you sort) and suppressing the details.


Posted By: SNelson
Date Posted: 10 Apr 2018 at 5:17am
Thanks for your suggestions. I have tried some things with grouping but have not tried the top 1 record so will look at that.

Re: SQL - I wondered this. I saw an SQL option in a different report that used a single record for a client based on the minimum value of a numeric field. Do you know of a minimum value command in SQL? If that's an option that might work too.



-------------
SNelson


Posted By: kevlray
Date Posted: 10 Apr 2018 at 12:57pm
The aggregate for minimum in MS-SQL is MIN.  Of course there is also the TOP X in MS-SQL also.



Print Page | Close Window