hello, I'm trying to display then number of packages posted on a given day per ship to customer and as a total. I figured I'd first calculate the number of packages per customer for a given day, but the report only calculates it for the first customer it finds. Here is what I used:
PostedPkg.SETRANGE("Posting Date", "Posting Date");
PostedPkg.SETRANGE("Ship-to No.", "Ship-to No.");
IF PostedPkg.FINDSET THEN
TotalPkgs := PostedPkg.COUNT;
It shows 11 pkgs for the first customer, but doesnt show the 3 pkgs for the other customer. what am I missing?
0
Comments
The (IF PostedPkg.FINDSET THEN) you doesn't need if you use it only for the count. Use the findset if you want to make a loop.
so better, if you doen't want to make a loop
Where did you put that code?
OnAfterGetRecord?
Dynamics NAV Enthusiast
I tried taking out the findset piece of code. so now it is
PostedPkg.RESET;
PostedPkg.SETRANGE("Posting Date", "Posting Date");
PostedPkg.SETRANGE("Ship-to No.", "Ship-to No.");
TotalPkgs := PostedPkg.COUNT;
but I still get the same outcome. its not finding or displaying the second set of pkgs for the other customer on that day
What about your dataitems? I think you might have only one dataitem? (if it is returning only one customer). You could try debugging and checking which data it's going through.
As I understand, you should have two dataitems:
- Customer
-- PostedPkg (linked to customer)
Dynamics NAV Enthusiast
now i'm confused.
You go through the "Posted Packages table" (the only DataItem). In these DataItem u use a new Record variable with name PostedPkg to count all PostedPkges with the same "Posting Date" and the same "Ship-to No." based on the "Posted Packages" Record in your DataItem. So where is here the customer ;-)
There must be something wrong in your report structure or your properties.
Let's see the whole reportsource here in a (CODE)(/Code) section as text
Make a report with Customer as the first dataitem, and then your packages table indented. Use the Link properties to Link it with the Customer ( no need for a setrange on Ship-to no), and the setrange on the Posting date can be done in the OnBeforeDataItem of the Packages table
So we will find your :bug: