Solved

Record counter reset when Customer Number changes

Posted on 2013-11-13
9
437 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
  • 6
  • 3
9 Comments
 
LVL 100

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 100

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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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 100

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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