I am trying to categorize sales activities based on the date of the activity. The sales manager is wanting me to change the calculations from gathering the sales activities by month to weekly. I have a form in the database that i need to have calculate the week (maybe starting date) of the date selected. I also need the view that is used for look-ups to categorize by the week as well.
I have the following code, but it seems to not be working correctly:
D := Dates;
temp1 := @Adjust(D; 0; 0; (@Modulo(7 - @Weekday(D); 7) - 5); 0; 0; 0);
temp2 := @Text(@Month(temp1));
temp3 := @Text(@Day(temp1));
temp4 := @Right(@Text(@Year(temp1)); 2);
temp5 := @If(temp2 = “1”; “01”; temp2 = “1”; “01”; temp2 = “2”; “02”; temp2 = “3”; “03”; temp2 = “4”; “04”; temp2 = “5”; “05”; temp2 = “6”; “06”; temp2 = “7”; “07”; temp2 = “8”; “08”; temp2 = “9”; “09”; temp2);
temp6 := @If(temp3 = “1”; “01”; temp3 = “1”; “01”; temp3 = “2”; “02”; temp3 = “3”; “03”; temp3 = “4”; “04”; temp3 = “5”; “05”; temp3 = “6”; “06”; temp3 = “7”; “07”; temp3 = “8”; “08”; temp3 = “9”; “09”; temp3);
temp5 +“/” + temp6 + “/” + temp4
I would appreciate any help here.
Jamie