Date Formula to Integer

fmhigue
Member Posts: 290
I got the following code
EVALUATE(LeadTime,FORMAT(USItem."Lead Time Calculation")+'+4D')
How can I change this to Integer?
Does any one of you have a manual on C/AL commands?
Thank you
EVALUATE(LeadTime,FORMAT(USItem."Lead Time Calculation")+'+4D')
How can I change this to Integer?
Does any one of you have a manual on C/AL commands?
Thank you
0
Comments
-
-
Hi
You could try this.
Declare a Variable if Type Integer eg. IntLeadTime
Then change the original Evaluate to this
EVALUATE(IntLeadTime,FORMAT(USItem."Lead Time Calculation")+'+4D')
Or You could just do
EVALUATE(IntLeadTime,FORMAT(LeadTime))Answer the question and wait for the answer.0 -
A date formula does not convert to an integer. What integer would you want 'CM + 4D' to convert to? The "value" of a date formula depends on the specific date the formula is applied to. You could pick an arbitrary date (e.g. TODAY, WORKDATE), use CALCDATE, and then subtract the original date from the result to arrive at an integer number of days. But the result will be dependent upon the arbitrary date you pick.0
-
Jreynolds:
Well then If i can't convert dateformula to integer. How can I add more days to initial value?
EVALUATE(LeadTime,FORMAT(USItem."Lead Time Calculation")+'+4D')
This is the line I have. So then I will prefer to add 4 days to inial value.0 -
Fun FactsThe date calculation formula can contain a maximum of 20 characters, both numbers and letters. You can use the following letters, which are abbreviations for time specifications:
C - Current
D - Day(s)
W - Week(s)
M - Month(s)
Q - Quarter(s)
Y - Year(s)
You can construct a date formula in three ways:
1. Current plus a time unit. For example:
CW - Current Week
CM - Current Month
2. A number and a time unit. A number cannot be larger than 9999. For example:
10D - 10 days from today
2W - 2 weeks from today
3. A time unit and a number. For example:
D10 - The next 10th day of a month
WD4 - The next 4th day of a week (Thursday)
You can combine these three forms as needed. For example:
CM+10D - Current Month +10 days
You can use a minus sign to indicate a date in the past. For example:
-1Y - 1 year ago from today0 -
You can always do arithmetic operations like LeadTime := LeadTime + 4. Also You can find difference like
IntegerValue := CALCDATE(YourDateFormula,TODAY) - TODAY0 -
i4tost it does not work like that
I am getting the following error message:
Type conversion is not possible because 1 of the operators contains an invalid type
DateFormula + Integer0 -
Show us your code line
AndréAndre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
This is my actual code
IF CompanyInformation."Country Code" = 'MX' THEN
EVALUATE(LeadTime,FORMAT(USItem."Lead Time Calculation")+'+4D')
ELSE
LeadTime:=USItem."Lead Time Calculation";
This way I get for example 14D + 4D
I tried the code LeadTime:=USItem."Lead Time Calculation"+4;
but I get the error message I previously said.
LeadTime: DateFormula
Thank you a lot0 -
OK, i think i did not understood what you asked
In this case you can do like this
EVALUATE(LeadTime,FORMAT(USItem."Lead Time Calculation") + STRSUBSTNO(TextConstant,YourIntegerNumber))
TextConstant in English must be +%1D, in other language it can be differ. System instead of %1 will place YourIntegerNumber0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions