Adding a group makes the report take forever to generate

I made a report using AR_Customer/AR_InvoiceHistory/AR_InvoiceHistoryHeader to find out the sales from a certain vendor and a UDF commission sales rep. It takes 30min to generate a months of data. If the report has already been generated I can add a Group for the UDF CommSalesRep and its almost instant. But if I close the Preview and add the group and try to preview it again it takes forever, and what I mean is never. Is there something special you need to do when adding a group?

Parents Reply Children
  • 0 in reply to BShockley

    AR_Customer / CustomerNo / UDF_LREPG (Sales Rep Group 4letters field)

    AR_InvoiceHistoryDetail / InvoiceNo / ItemCode / QuantityShipped / QuantityOrdered / UnitPrice / VendorNo

    AR_InvoiceHistoryHeader / InvoiceType / InvoiceDate

    AR_InvoiceHistoryHeader (InvoiceNo Inner Join Not Enforced = to AR_InvoiceHistoryDetail InvoiceNo)

    AR_InvoiceHistoryHeader (CustomerNo Inner Join Not Enforced = to AR_Customer CustomerNo)

    I even tried to copy the SQL out and put it in a new report with Add Command and it wouldn't even work.

  • 0 in reply to Darkjedi

    Add Division to the customer table link, and HeaderSeqNo to the invoice header / detail link.

    Groups load all the report data into memory and then sort it, and CR is not a great database engine for that kind of thing. 

    Add report selection criteria so the result set is smaller (i.e. less data processing for the CR engine).

  • 0 in reply to Kevin M

    Thanks Kevin, when you way Add Division do you mean adding another link?

    AR_InvoiceHistoryHeader/HeaderSeqNo Inner Join Not Enforced = to AR_InvoiceHistoryDetail

    I've criteria everything that I could

    {AR_InvoiceHistoryDetail.VendorNo} = "0000833" and
    {@Total Sale} >= 0.01 and
    {AR_InvoiceHistoryHeader.InvoiceDate} = {?Date Range}

    Thanks for all your help

  • 0 in reply to Darkjedi

    Add another field to that table link.

    Make sure you handle NULL values in your UDF.  CR notoriously doesn't deal with NULL field values well.  Perhaps add a report selection clause to exclude NULLs / blanks.

  • 0 in reply to Kevin M

    I have it starting on AR_InvoiceHistoryHeader