This was extracted from codeunit 5400....
Item.SETRANGE("Date Filter",0D,NewItem.GETRANGEMAX("Date Filter"));
I can't get my head around this one! I understand its preparing the "Date Filter" for the following CALCFIELD based on day 1 to.... and this is what I dont understand. What is NewItem.GETRANGEMAX("Date Filter") going to return?
Thanks
0
Comments
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
From what I understand, the "Date Filter" of var Item is set via the first SETRANGE but never is it set for var NewItem... So what Max date is it trying to find in NewItem on the last line?
Or am i not understanding this correctly?
Item.COPY(NewItem);
Available := 0;
IF Item."Include Inventory" THEN
Item.CALCFIELDS(Inventory);
IF CalcAvailable THEN BEGIN
Item.SETRANGE("Date Filter",0D,PlannedOrderReceiptDate);
Item.CALCFIELDS(
"Qty. on Sales Order",
"Qty. on Kit Sales Lines",
"Scheduled Need (Qty.)",
"Trans. Ord. Shipment (Qty.)",
"Qty. on Service Order");
InitialQtyAvailable :=
Item.Inventory -
Item."Qty. on Sales Order" -
Item."Qty. on Kit Sales Lines" -
Item."Scheduled Need (Qty.)" -
Item."Trans. Ord. Shipment (Qty.)" -
Item."Qty. on Service Order" -
ExtraNetNeed;
Item.SETRANGE("Date Filter",0D,NewItem.GETRANGEMAX("Date Filter"));
Salut!
Author of the book Implementing Dynamics NAV 2013
Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
It's using the "Shipment Date" or "Planned Delivery Date" or "Planned Shipment Date" of the sales line. I didn't do a deep test so don't know which one exactly.
Salut!
Author of the book Implementing Dynamics NAV 2013
Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
Also, I looked a little deeper (or less deep actually) and found that "Item" record var is being assigned a "Date Filter" before the call to codeunit 5400.
Item.SETRANGE("Date Filter",0D,0D);
Now, is that filter passed on the "NewItem" record var when it is copied on the first line of the codeunit? And if so, would that mean that the "Date Filter" on the line that im trying to understand (see below) would be set from 0D to 0D? :?
Item.SETRANGE("Date FIlter", 0D, NewItem.GETRANGEMAX("Date Filter""));
Thanks