Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Build and Display Unique Values Post Reply Post New Topic
Author Message
vcs1161
Newbie
Newbie


Joined: 03 Mar 2010
Online Status: Offline
Posts: 33
Quote vcs1161 Replybullet Topic: Build and Display Unique Values
    Posted: 13 Feb 2014 at 5:08am

I need to build multiple dates in one field that is grouped by a customerID.  This process is working with the exception of it repeating the same date more than once.  There can be multiple items for the customer on the same date but I just want the UNIQUE date to be displayed once and not for each record line.  Can someone guide me as to where I am going wrong and if there is a solution for this?  Greatly appreciated.

For instance I get 12/23/2013, 12/23/2013, 12/28/2013 if the customer had more than one item on the same day.  I would like this to display as 12/23/2013, 12/28/2013.

 
This what I am using to build the date s in the field:
whileprintingrecords;
stringvar CertainDates;
if CertainDates<> ""
then CertainDates:= CertainDates+ ", ";

CertainDates:= if {Command.FieldName} = 1 then CertainDates+ ToText (({Command.Date}),"M/dd/yyyy " );

Then I am displaying them in the CustomerID group footer:
whileprintingrecords;
stringvar CertainDates;
CertainDates;
 
This is reset on the CustomerID group header:
whileprintingrecords;
stringvar CertainDates;
CertainDates:= " ";
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 13 Feb 2014 at 5:27am
if the dates are in order then it should be fairly simple.  If not, then it becomes much more difficult.  The easiest is probably checking the current row with the previous row;  Something like this;

If previous({Command.Date}) <> {Command.Date} then do the code to add the date toe CertainDates

I hope this helps.
IP IP Logged
vcs1161
Newbie
Newbie


Joined: 03 Mar 2010
Online Status: Offline
Posts: 33
Quote vcs1161 Replybullet Posted: 13 Feb 2014 at 5:53am
Thank you very much.  I was not familiar with the Previous function.  I believe it is now working the way I need it to.  I found that I need to do the opposite with
If previous({Command.Date}) = {Command.Date}. Smile
 
I did look this up in the Crystal Help tool now that I am aware of it and this is how it is explained:
 
Tests the previous value in the {file.QTY} field to see if it is a zero value. If it is not, it divides the value by two. If it is a zero value, it returns the value itself.
If Previous ({customer.CUSTOMER ID}) = {customer.CUSTOMER ID} Then
     "Repeated Value"
Else
     ""
I sincerely appreciate your prompt attention and guidance to get me through this.
 
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.016 seconds.