Solved

Record counter reset when Customer Number changes

Posted on 2013-11-13
9
439 Views
Last Modified: 2013-11-14
I set up a counter to count the number of invoices a customer generated during a period of time.
//@Counter of Customer Invoices
NumberVar invcounter;
whileprintingrecords;
invcounter := invcounter +1;

//@Counter of Customer Number
NumberVar counter;
whileprintingrecords;
counter := counter +1;

This counter works...However I need to reset the counter of the customer invoices when the next new customer comes up (I am using grouping on the customer number and Customer invoice.  This is so  I can determine that the invoice number changes I can compare data from the previous invoice for a specific product to see if selling that product(sample) produced new sales.

How do I reset the counter back to "0" if the customer number changes?

In summary I am trying to see if a sample product sold yesterday produced a new sale of that type of product today.
0
Comment
Question by:Scott Johnston
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 500 total points
ID: 39646433
How is the report setup?

I assume you have
Group1 - Customer
Group2 - Product
Group3 or sort order - Invoice

If the report is limited to a specific product then the Group2 isn't needed.

In the customer group header add a formula - reset on customer change

whileprintingrecords;
NumberVar counter;
counter := 0;

Open in new window


In the invoice group header do the counting

You can check the previous record
whileprintingrecords;
NumberVar counter;
If OnFirstRecord or Previous({InvoiceNumberField}) <> {InvoiceNumberField} then
    counter := counter + 1;

Open in new window


mlmcc
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 500 total points
ID: 39646436
If you have the groups as above you can use a summary

If you have a product group

    DistinctCount({InvoiceNumberField},{ProductField})


If you are running for 1 product and just have the customer group

    DistinctCount({InvoiceNumberField},{CustomerField})


mlmcc
0
 

Author Comment

by:Scott Johnston
ID: 39646438
I just have:
 
Group1 Customer
Group2 invoice #
Details (products)
0
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

 

Author Comment

by:Scott Johnston
ID: 39646449
I like previousrecord, never used it,
when I try the command I get a error the formula result must be a Boolean?
0
 

Author Comment

by:Scott Johnston
ID: 39646459
hmmm, I took out ' : ' and it fixed the problem.
Previous record may not work because the invoice for each customer are not necessarly in order.

Customer A has invoice number 1234567 and his next invoice number is 2345690.

I got a false on every entry which I know there are 2 invoice in some cases.
0
 

Author Comment

by:Scott Johnston
ID: 39646476
I have distinct count setup already, I cannot use that to check to see if the record changed?
If I can I not sure how?
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39646720
You have to have the report set up as I suggested to be able to use the previous idea.  If you don't then the previous record will most likely be for a different product.

What you are asking for is a difficult formula using arrays and counters.  I am not even sure if it is possible.

Can an invoice have 2 detail lines for the same product?

mlmcc
0
 

Author Comment

by:Scott Johnston
ID: 39649026
I beginning to think that as well...Marketing is trying to get data that will support a marketing program.  I have decided to break this into separate reports.
Thanks for the support!
0
 

Author Closing Comment

by:Scott Johnston
ID: 39649044
Thanks for the Support
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question