Hi everyone
Hope everyone is all good.
I have the following code
IF WORKDATE < "Purchase Line"."Expected Receipt Date" THEN
NoOfDays := FORMAT("Purchase Line"."Expected Receipt Date"-WORKDATE);
When this code is run It does not return a negative date. It just makes the date value equal to 'BLANK'. Am I doing something wrong.
0
Comments
[code]
you have your logic backwards. The second line wont execute if its negative.
If WD <> ERD then
No.Of.Days := ( ERD - WD);
I get an error message saying that date is not valid
what is DataType of No.Of.Days
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
and the function is
IF WD <> ERD THEN
No.Of Days := FORMAT(ERD-WD);
I am not getting any error.
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Thanks for all the help works like a charm
welcome and thanks for ur comment
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
2. You can't do any math with blank dates
3. Subststracting two dates gives you integer - number of dates between two dates
So if you're getting error messages it means that either ERD, or WD, or both are blank dates. In your case "Purchase Header"."Expected Receipt Date" must be blank
Regards,
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03