Formula & Evaluation time problems

Posted on 2006-05-03
Last Modified: 2011-10-03
Hello, we issue pre-numbered licenses that we receive from the state of Ohio.  We have to account for each license, so if any are destroyed while printing, we must account for them.  When we print an "audit" sheet for the licenses, we have to show any license # that was voided during printing.  So for example, we issue 10 licenses at a time.  The user prints them out on the license paper and the 5th one get's jammed in the printer.  So they have to "void" license number 1005.  On our audit sheet, we have to show that license # 1005 was destroyed in printing.  The way we print out our audit sheets is that we put the voided #'s first and then the rest in consecutive order.  So what should be printing out is "1005 VOID", then license #'s 1000, 1001, 1002, 1003, 1004, 1006 thru 1011.  We have the report prompt for the beginning audit # and up to 5 voided audit #'s.  We created an incremental formula that adds 1 to the beginning audit number and on any row that the audit number matches any of the voided audit #'s, we increment by 2, otherwise just by 1.  Our problem is that everything is working except that it's printing the audit number on the report "before" it's being incremented to the next appropriate number if the prior number was voided.  Because the increment needs to happen on each record that's read into the report, we can't use the "beforereadingrecords".  Keeping in mind that there can be up to 5 voids per audit sheet.  
Question by:schealth
    LVL 42

    Expert Comment

    Assuming you are printing the records in the Details section, what I would do is add a new details section above the current one and put your incrementing formula there.  Crystal should evaluate the formula in DetailsA before doing the printing in DetailsB.  Obviously you can suppress the DetailsA section so it isn't visible on your report.

    Another option is to just do a UNION query to join the void with the "unvoid" and then group by void status first, then sort by number.  This gets you away from having to do the funky logic at all.

    LVL 100

    Expert Comment

    In general I agree.

    The problem is the way Crystal determines the order of evaluation.  Crystal uses two thing to determine the order.  Position in the report and order in which the objects are placed onto the report.

    One thing to try if you don't want to use the extra detail section
    Delete both the formula and the field from the report
    Insert the formula near the top of the detail section
    Insert the field.

    I think from a complexity standpoint the extra detail section may be easier to understand and maintain.


    Author Comment

    First off, thanks to both frodoman and mlmcc for the quick response.  Here's how things turned out....  
    I added the second detail section and the incrementation worked just fine for when the voided licenses were in sequential order (thank you frodoman).  However, when there were multiple voids not in sequential order, it would still print the formula field before it incremented.  I believe this was due in part to the fact that the formula didn't contain fields from the database, just parameters from the user so it would print it out during one of the earlier passes through the engine.  So what I tried was instead of having the incremental formula skip to the next audit # when there was a non sequential void #, I had the formula that held the results of the incremental formula check for it instead and it worked.  Keep in mind that I've only been using Crystal XI for about a year so I am far from knowing how the engine actually works.  Thanks to the both of you again (mlmcc, i'm going to try your suggestion in another similar report and have no doubts it will work too).

    LVL 42

    Accepted Solution

    Glad you're moving in the right direction.  Please let us know if you need further assistance.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now