Hi all ,
I want to change the value of all the records in the table based on first record modification.
Suppose i am having 2 fields like “start Date” and "End Date " with 3 record.
The records are like this.
Start Date End Date
07-07-2014 10-07-2014
10-07-2004 13-07-2014
13-072014 16-07-2014
Now if i change the value of first record startDate to 08-07-2014 then My answer should be like this
Start Date End Date
08-07-2014 11-07-2014
11-07-2004 14-07-2014
14-072014 17-07-2014
Can anyone suggest me regarding this. because i am very new to Navision .
Thanks in advance
Well, right off the top, I think this can get complicated quickly. Your first step will be to determine the delta between the original date value and the new one. You can easily enough determine the number of days between the two dates. Then you can use that number as an argument to the CALCDATE function to derive the new values for the remaining dates. The aspect of the process that makes this complicated is the fact that months have a varying number of days in them. So, knowing that you’ve added 30 days to the first date, you’d think you could add 30 days to the other dates and be done. But what happens when you’re adding 30 days to a date in February? What happens when you change the original date from 1 Jan 2014 to 1 Feb 2014? If the Start Date of the second record is 1 Feb 2014, adding 30/1 days to that will put the new Start Date to something beyond 1 Mar 2014.
So, depending on your business rules managing these dates, you may have a challenge. If you know in advance that these dates will all be advanced by exactly 1 month, then you can use CALCDATE farily effectively. If you’re reduced to counting the number of days between the original and new value of Start Date on the changed record, you can still use CALCDATE, but you’ll see the day of the month slide up or down depending on the month value. If that causes an issue, you’ll need to write code to trap for that error and adjust for it.
Hope that helps. I know it’s high-level, but you’ll make a lot of progress looking at the documentation on the CALCDATE function.