I have to work on this complicated formula and need some help with it.
I have these two columns that look like below (Right now the columns below are not in any table)
I have these 3 fields in my table - Interval_length, Earliest_Date, Scheduled_Date.
I first need to check the data in my table for interval_length and if it matches any value in column 1 then I move to column 2.
So for example if interval_length in my record is M and it matches the 3rd value in column 1, I look at the corresponding value 001MM007DD
in column 2 and use that to do further calculations.
Based on 001MM007DD I need to calculate the next Scheduled_Date, Earliest_Date. First 5 letters, 001MM tells me the next scheduled date.
So if my current scheduled_date is 06/08/05 the next scheduled_date will occur after 1 month i.e. 07/08/05. After calculating this part
the remaining date fields Earliest_Date and Latest_Date are calculated. To calculate these fields we look at the remaining text in
001MM007DD i.e 007DD. So the new earliest_date will be -7 days from the new scheduled date.
So it will look like
I would appreciate any help.
I have these two columns that look like below (Right now the columns below are not in any table)
Code:
[b]Column 1 Coulmn 2[/b]
[b]DD[/b] Daily 001DD000DD
[b]SW[/b] Semi-Weekly 003DD001DD
[b]M[/b] Monthly 001MM007DD
[b]SA[/b] Semi-Annual 006MM030DD
[b]A[/b] Annual 001YY060DD
and so on...
I have these 3 fields in my table - Interval_length, Earliest_Date, Scheduled_Date.
I first need to check the data in my table for interval_length and if it matches any value in column 1 then I move to column 2.
So for example if interval_length in my record is M and it matches the 3rd value in column 1, I look at the corresponding value 001MM007DD
in column 2 and use that to do further calculations.
Based on 001MM007DD I need to calculate the next Scheduled_Date, Earliest_Date. First 5 letters, 001MM tells me the next scheduled date.
So if my current scheduled_date is 06/08/05 the next scheduled_date will occur after 1 month i.e. 07/08/05. After calculating this part
the remaining date fields Earliest_Date and Latest_Date are calculated. To calculate these fields we look at the remaining text in
001MM007DD i.e 007DD. So the new earliest_date will be -7 days from the new scheduled date.
So it will look like
Code:
Interval_length Scheduled_Date Earliest_Date
M 06/08/05 05/28/05
M 07/08/05 07/01/05(after calculation)
Another example for interval SW and 003DD001DD would be
Interval_length Scheduled_Date Earliest_Date
SW 06/08/05 05/28/05
SW 06/11/05 06/10/05
I would appreciate any help.