I want to count the number of Sales Orders for each Customer in the Sales header table.
In a report based on Sales header table, in the OnPreDataItem trigger I wrote this code
SETRANGE("Document Type",1);
nbre :=0;
IF FIND('-') THEN
REPEAT
nbre := nbre +1;
UNTIL NEXT =0;
But it counts me all the sales orders and not by each customer
Help Please
Comments
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
But to also help you understand why it's showing the number of all orders: You only are filtering out the documents of type '1' (as you use in your code - but see below), being the orders, but not filtering out the document for a specific customer. To get that working your code should be: Or even much shorter where CustomerNo is of Type Code20 holding the number of the customer you want to count for.
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
I want to display the number of ordes for many customer in one , and this code is only for one customer.
You can create those fields in your version by looking at the new version..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav