hi,
i've got a date , shipmentdate. i've got safety lead time that i get from the item card.
i need to subtract the lead time from the shipment date. the shipmentdate is a dateformula format, so is my lead time.
what i'm want to do is actually
b:= ShipmentDate - Leadtime
but i'm stuck with the syntax
i tried
DateToOrder := CALCDATE(Item."Safety Lead Time", PeriodStartDate)
but i need to subtract item."safety Lead Time" from PerodStartDate but can't figure out how :oops:
thanks
0
Comments
The call to calculate a new date from an existing date with a Date Formula is 100% correct. The problem here is not a syntax error, but rather a logical error.
Think about it logically: You enter your "Safety Lead Time" on the Item Card as, for instance: 5D (5 Days).
You then try to calculate the new date using:
DateToOrder := CALCDATE(Item."Safety Lead Time", PeriodStartDate)
Instead of subtracting % days from the PeriodStartDate, the system will add 5 Days.
There are 2 solutions to this:
1. The best solution is to construct a new "Safety Lead Time" before you calculate the date. Convert the DateFormula to Text, test for a minus sign as the first character, if no minus sign was found, add one to the beginning of the string. Convert the new text to a DateFormula using EVALUATE and then calculate the new date.
2. Add code to the OnValidate trigger of the "Safety Lead Time" field to ensure users enter a negative date formula. (Only do this if you don't utilise any other features that uses the Safety Lead Time functionality.
/Wiechardt
This should work.