Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys can anyone help?
I am trying to archive the following but not sure how to go about it:
I need to create week fields as:
T+1 = Prior to current week
T-0 = Current week
T-1 = one week from the current week
T-2 = two weeks from the current week
T-3 = three weeks from the current week
T-4 = four weeks from the current week
T-5 = five weeks from the current week
T-6 = six weeks from the current week
The 'T-0' (current week) needs to be a dynamic variable where the user enters the date in to an input box they wish to report on and T-1, T-2, etc change accordingly to whatever date has been entered.
Thanks in advance
Right-click > New sheet object > Input box
Select new Variable
Jonathan
Hi guys I think i am almost there i have created the following:
SET TCurr= WEEKSTART($(vVar)); //T-0
SET TPrev= WEEKSTART($(vVar),-1); //T+1
SET TAfterOne= WEEKSTART($(vVar),+1); //T-1
SET TAfterTwo= WEEKSTART($(vVar),+2); //T-2
SET TAfterThree= WEEKSTART($(vVar),+3); //T-3
SET TAfterFour= WEEKSTART($(vVar),+4); //T-4
SET TAfterFive= WEEKSTART($(vVar),+5); //T-5
SET TAfterSix= WEEKSTART($(vVar),+6); //T-6
The problem I am having now is WEEKSTART function is giving me all dates from the Start of the week (Monday)
How can I change this so that the start of the week can be any day the user selects? e.g if the user selects a date that falls on a Wednesday then all the days will changing according to that? and the Wednesday will taken as the start of the week.
WeekStart takes a 3rd parameter (weekoffset), which you can make a configurable variable: See Reference manual, page 349 (Qv11):
WeekStart(date [, shift = 0 [,weekoffset = 0]])
Returns a value corresponding to a timestamp with the first millisecond of the first date ( Monday ) of
the calendar week containing date. The default output format will be the DateFormat set in the script.
Shift is an integer, where the value 0 indicates the week which contains date. Negative values in
shift indicate preceding weeks and positive values indicate succeeding weeks. If you want to work
with weeks not starting midnight between Sunday and Monday, indicate an offset in days in weekoffset. This may be given as a real number indicating days and/or fractions of a day.