Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

counting the number of lines per order 1

Status
Not open for further replies.

deetee2k

Programmer
Nov 25, 2000
90
IE
I hope someone can help me...

I want to count the number of parts in an order (one order can have many parts).
I have tried grouping by order number, then counting all the orders within that group. Really what i want is the count of a count. So far i have;

count({order_no},{order_no})

placing this at the order_no group footer gives me the number of parts per order, now how do I count this value over many orders??

Any help is greatly appreciated,

D. "I want to play..."
(Guess the episode!)
 
Assuming you have Crystal 7.0, 8.0 or 8.5 you need to create a RUNNING TOTAL. Click on a field in the parts table as the field to sumarize. Choose 'count' as the type of summary.

In the Evaluate section pick 'on change of group' and pick the group associated with your Order Number field.

In the Reset section pick the group you want to show the count of counts. Perhaps 'customer' or 'salesman'.

Save the running total and place in the group footer (not the header) of that group. That is, the group associated with 'customer' or 'salesman'.

good luck. Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Thanks very much for that, unfortunately it didn't work! I think I have a solution but it involves returning a value from a variable, here's another question - how can I get a crystal function to spit out the value of 'counter'? (Where counter is an integer variable)

Ta,

D. "I want to play..."
(Guess the episode!)
 
you need to declare and load a variable such as:

@reset
whileprintingrecords;
shared numbervar test :=0

@accum
whileprintingrecords;
shared numbervar test := test +1

@display
whileprintingrecords;
shared numbervar test;
test

place @reset in the report header (or elsewhere)

Place @accum in the details (or elsewhere)

Place @display in the report footer (or elsewhere)

test := test Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Well I solved it,

In the report header insert an intialise function with an initialised counter.
Global Numbervar counter := 0;

In the detail section insert a supressed field with
count({order_no},{order_no});
which, for each order_no will pop-up the number of times it occurs in the report.

Insert another supressed field to count the number of times the above formula equates to less than 20

evaluateafter({@NumLines});

Global Numbervar counter;
if {@NumLines} < 20 then counter := counter + 1;
counter;

In the report footer just print the value of counter...
evaluateafter({@getOrdersLT20LI});
global Numbervar counter;
counter;

Just thought I'd share this in case any other newbie has to deal with a similar problem.

Ta,

D. &quot;I want to play...&quot;
(Guess the episode!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top