Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Loop Post Reply Post New Topic
<< Prev Page  of 2
Author Message
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 28 Mar 2012 at 3:51am
Originally posted by rkrowland

Group by Client_Name;

Create a formula, we'll call it @day;
 
@day
datediff("d",#01/01/1901#,{table.datefield})
 
Now create another formula as follows;
 
 
This will count the number of separate days invoices were processed for each client.
 
That's what this does. It will give you the number of separate days for each client.
 
IE
 
ABC has 2 invoices, one on 01/01/2012 and the other on 02/01/2012, ABC will have a distinct count of 2 using the above..
 
XYZ also have 2 invoices, both on 01/01/2012... XYZ will have a distinct count of 1 using the above.
 
Thanks,
Ryan.
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 28 Mar 2012 at 4:22am
Sorry, I see now why we are miscommunicating.

The client is the company. I want to show how many customers there are entered. This are 2 completely different things in our database. Sorry for the misguidence.

So for each client, I want a count of the customer ID. per day I want to count each unique customer. And if a customers gets more than 1 invoice on different dates, then I want to count 1 for every date (within the date range of course).

Again, sorry for the misguidence
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 28 Mar 2012 at 4:35am
Right, I think I see what you're getting at now haha! :o)
 
Try this;
 
Group by table.Client_Name
 
Create a formula, we'll call is @uID;
 
@uID
totext({table.customerid},0,"")
& "-"
& totext(datediff("d",#01/01/1901#,{table.datefield}),0,"")
 
Now create a distinctcount on this field in your client name group,
 

 
If I understand you correctly this is what you want.
 
It merges the customer data with the date data to give a new unique customer id based on the date of the invoice.
 
IE in my previous example we'll assume the 2 customers are the only 2;
 
Client Alphabet would have a distinct count of 3 based on the following 4 records;
 
ABC-01/02/2012
ABC-02/01/2012
XYZ-01/01/2012
XYZ-01/01/2012
 
Let me know if I'm still not getting it haha! :)
 
Regards,
Ryan.


Edited by rkrowland - 28 Mar 2012 at 4:36am
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 29 Mar 2012 at 12:03am
I'm getting the error message "There are too many arguments given to this function" with your first formula. How can I fix this?
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 29 Mar 2012 at 12:10am
Originally posted by Gurbs

I'm getting the error message "There are too many arguments given to this function" with your first formula. How can I fix this?
 
Try this instead;
 
totext({table.customerid})

& "-"

& totext(datediff("d",#01/01/1901#,{table.datefield}),0,"")
 
It depends on the datatype of your customerid field, if it's already datatype string you can completely remove the totext brackets around it.
 
Regards,
Ryan.
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 29 Mar 2012 at 12:45am
It took a while, but now it is finally working perfect! Thanks Ryan
IP IP Logged
<< Prev Page  of 2
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.047 seconds.