You could smartly involve calculating WeekOfYear ( date ) in your reporting, taking the starting day of the visit, and group by that.
1 of 1 people found this helpful
Any suggestions/ contributions are much appreciated
Here is one: it doesn't make sense (and is most inefficient) to first Show all Records, then sort them, then constrain them.
Imagine this sequence of events for a total record set of 100,000, where frequently you are only interested in sets of ~50 …
Also, why set a global variable with value that you then write into globals? If you need these globals for .g. a relationship, forgo the variable, write directly. Also, avoid global variables unless you want to use beyond the script (mostly, you don't want to).
Anyway, to find records for the last 7 days try:
Enter Find Mode
Go to Layout [ Consultants ( Consultants ) ]
Set Field [ Consultants::dateField ; Get ( CurrentDate ) - 7 & ".." ]
# [ other Set Fields as necessary to add more AND requests ]
Set Error Capture [ on ]
If [ not Get ( FoundCount ) ]
Show Custom Dialog [ error ; … ]
Go to Layout
# [ search successful … ]
Sort [ … ]
I had a similar problem where I wanted to chart weekly data. week of the year wont work when you go to the next year.
I created this calc:
Left(GetAsNumber ( TheDate ) / 7;6)
This will provide a number for the week that can be used even when the year changes.
The number stays the same for week.
Actually what we use is WeekOfYearFiscal