Selection

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hi

I have a report that shows the total requirement of a product. Which can be selected from numerous batches.

Is there any way in crystal to show the required batches.

So if I have a total of 10 and 3 batches with totals stored in the database of:

BTC 1 = 5
BTC 2 = 3
BTC 3 = 10

The report would return
BTC 1 = 5
BTC 2 = 3
BTC 3 = 2

Or if I had:
BTC 1 = 500
BTC 2 = 3
BTC 3 = 10

The report would return
BTC 1 = 10

Thanks for any help.

Ed


I am double checking that I understand the question and the examples. 1) you have a total 10 items that can be distributed among the 3 batches, and there is some logic that distributes the 10 items to the batches.

The examples listed show the requested amounts per batch and the report is returning which batch(es) should get which amount(s).

Hopefully, I got that correct.

I want to say that Crystal can do it, and I have a path to follow. I not sure how well I can explain it.

Here is the outline, and you will have to fill in a bit.
You will have a formula that calculates the number of items to assign to a batch (following the logic above). It will have to compare it's logic to how many items you actually have on hand, decreasing this amount as it assigns an amount to a batch. When there are no more items, I would have the formula assign 0. Hopefully, this makes it easier to code as it consistent.

Then in the display section, I would put in a suppression formula that looks something like: AssignedUnits = 0

The AssignedUnits would be a variable (either global or shared depending on if subreports are involved) and is the set in the formula.

This is all thinking off the top of my head as there is not much to go on in the post.

HTH

Yes that's it - I'll work through your explanation and let you know how it goes, thanks for your help
Ed
Couldn't get it working but I'll keep trying!