Formula & Evaluation time problems

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.  
Who is Participating?
Glad you're moving in the right direction.  Please let us know if you need further assistance.

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.

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.

schealthAuthor Commented:
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).

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.