CalcDate based on Month (Eg: 08-07 or August 07)

nikeman77
Member Posts: 517
I have a posting date filtering set by user.
If user set 01-08-07..3108-07, mine Cust. Ledger Entry.GetFilter("Posting Date") would retrieve value of 08-07 or Aug 07.
Eg: FilterText := Cust. Ledger Entry.GetFilter("Posting Date");
If Evaluate (FilterDate,FilterText) Then; //convert filter text to date format
Now I would like to FilterDate1 := CalcDate('-1Y', FilterDate) ?
It gave me an error:
You cannot base a date calculation on an undefined date.
Date : 0D
Formula: -1Y
If user set 01-08-07..3108-07, mine Cust. Ledger Entry.GetFilter("Posting Date") would retrieve value of 08-07 or Aug 07.
Eg: FilterText := Cust. Ledger Entry.GetFilter("Posting Date");
If Evaluate (FilterDate,FilterText) Then; //convert filter text to date format
Now I would like to FilterDate1 := CalcDate('-1Y', FilterDate) ?
It gave me an error:
You cannot base a date calculation on an undefined date.
Date : 0D
Formula: -1Y
0
Comments
-
Try this,
If Evaluate (FilterDate,FilterText) Then
FilterDate1 := CalcDate('-1Y', FilterDate)0 -
hi dayakar,
if input for filter text = 08-07 ?
(Aug 07)
Does the calcdate works?0 -
Input for date filter can not be a month only, it will consider the Day of the month also.
What exactly you want to achieve?0 -
Hi dayakar,
I wanted to put a date range (01-08-07..31-08-07), but I realized while I was testing the output was
08-07 instead. Not sure if I had key in wrongly.
Consider that user might be keying it wrongly too.
JDI0 -
Hi,
If user simply enters 08-07 then system will consider as the 08-07-(Current year) i.e 08th day of July .
It does not mean that Aug'07
If you want to get the Minimum date and Maximum date entered in the Date filter then use the
GetRangeMin and GetrangeMAx functions.0 -
Hi dayakar,
Thanks, will do.
In that case if I need to offset user input date by 1 year I would do as follows:
StartDate := GetRangeMin(DateFilter); EndDate := GetRangeMax(DateFilter);
StartDate1 := CalcDate..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