| Author |
Message |
TJWheelz
Newbie
Joined: 13 Dec 2013
Online Status: Offline
Posts: 3
|

Topic: CR9 - Selective Suppress detail lines by quantity Posted: 27 Dec 2013 at 2:23am |
|
I have a report that gives me detail based on and existing order. The details show every line of detail for a specific item. I would like to suppress the detail after it reaches the total quantity shipping plus 2 extra units. I've tried various formulas with out success.
Any ideas would be helpful.
|
IP Logged |
|
|
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 27 Dec 2013 at 5:15am |
|
in group header for specific item:
shared numbervar totShipped := 0;
shared numbervar shippingQty := x;//you will have to supply the number of the shipping quantity + 2...it might be a sum for the group, or some other criteria
"" // hide the zero on the report
in the section expert, for the detail section (since this is what you want to suppress):
shared numbervar totShipped;
shared numbervar shippingQty;
totShipped := totShipped + {table.field};
totShipped > shippingQty
this will keep a running total of the total quantity shipped, and when it exceeds the amount set, it will return TRUE, which will suppress the detail line, otherwise it will return FALSE, which will display the line.
Suppression is a bit odd, as true means hide and false means show...but if you look at it from 'Should I suppress this line of data' the true/false make perfect sense.
HTH
|
IP Logged |
|
TJWheelz
Newbie
Joined: 13 Dec 2013
Online Status: Offline
Posts: 3
|

Posted: 27 Dec 2013 at 5:44am |
|
Thanks. Forgive me, but I know how to add to the suppression of the detail, but where do I add the declaration for the group header variables?
Edited by TJWheelz - 27 Dec 2013 at 6:00am
|
IP Logged |
|
TJWheelz
Newbie
Joined: 13 Dec 2013
Online Status: Offline
Posts: 3
|

Posted: 27 Dec 2013 at 8:58am |
|
I must have done something wrong. No matter the unit count, I only get 2 lines of detail. totShipped calculates correctly, but I don't get a line of detail for each addition.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 27 Dec 2013 at 9:26am |
|
hmmm...
well, first question...where do you initialize the group:
create a formula with the initialization code in it and place the formula in the group header. so much for the easy one.
if totShipped is calculating correctly, one would think that the issue would be with shippingQty...or the logic.
Here is what I would do:
Create a bunch of 'helper' formulas and display them in the detail section. I would remove or comment out the suppression logic...after all we are debugging here ;)
The helper functions would be like:
formula1: shared numbervar totShipped
formula2: shared numbervar shippingQty
formula3: shared numbervar totShipped;
shared numbervar shippingQty;
totShipped > shippingQty
etc...
since none of us 'knows' how CR works or what it 'sees' breaking the formulas into smaller parts and being able to compare it to the actual values in the report makes it easier to figure out what is happening.
as an aside...it just dawned on my that you don't really have to disable the logic in the suppression, just add the work 'false' to the end, so that the suppression will never take place.
HTH
|
IP Logged |
|
|
|