Date Calc error

mb6606
Member Posts: 30
Can anyone help with the following Date Calc? I get a date time unit error message on the Calcdate line thanks in advance.
startd and endd are variable date field from user Option Request form
FOR Y:=1 TO 12 DO BEGIN
IF startd<>0D THEN BEGIN
sd[Y] := STRSUBSTNO('-%1M+startd',Y);
ed[Y] := STRSUBSTNO('-%1M+endd',Y);
END;
sd2[Y]:= CALCDATE(sd[Y]);
ed2[Y]:= CALCDATE(ed[Y]);
END;
startd and endd are variable date field from user Option Request form
FOR Y:=1 TO 12 DO BEGIN
IF startd<>0D THEN BEGIN
sd[Y] := STRSUBSTNO('-%1M+startd',Y);
ed[Y] := STRSUBSTNO('-%1M+endd',Y);
END;
sd2[Y]:= CALCDATE(sd[Y]);
ed2[Y]:= CALCDATE(ed[Y]);
END;
0
Comments
-
keep this in mind when using CALCDATE:NewDate := CALCDATE(DateExpression [, Date])
NewDate
Data type: date
The date the system computes from the reference date and the date expression.
DateExpression
Data type: text, code or dateformula
The date expression can be any length. The system interprets the string from left to right, one subexpression at a time.
Date
Data type: date
Use this optional parameter to define a reference date. The default is the current system date.kind of fell into this...0 -
Yes I solved before you post.
Thanks anyway for your help!!0 -
mb6606 wrote:Can anyone help with the following Date Calc? I get a date time unit error message on the Calcdate line thanks in advance.
startd and endd are variable date field from user Option Request form
FOR Y:=1 TO 12 DO BEGIN
IF startd<>0D THEN BEGIN
sd[Y] := STRSUBSTNO('-%1M+startd',Y);
ed[Y] := STRSUBSTNO('-%1M+endd',Y);
END;
sd2[Y]:= CALCDATE(sd[Y]);
ed2[Y]:= CALCDATE(ed[Y]);
END;
Do not forget to add '<' and '>' around the string before passing it to the CALCDATE, else you will have problems when you switch client into another language.0
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