Chances are that later you will need to find outdated items in another timeframe.
Make a calculation field(findDate)result text, indexed, along these lines:
Case(
GetAsNumber(yourItemDate) = GetAsNumber(Get(CurrentDate));"Today";
GetAsNumber(yourItemDate) = Get(CurrentDate) - 1;"Yesterday";
GetAsNumber(yourItemDate) = Get(CurrentDate) - 2;"Last " & DayName(yourItemDate);" "
)
& "¶" &
Case(
WeekOfYear(yourItemDate) = WeekOfYear(Get(CurrentDate)) and Year(yourItemDate) = Year(Get(CurrentDate)); "This week";
WeekOfYear(yourItemDate) = WeekOfYear(Get(CurrentDate) - 7) and Year(yourItemDate) = Year(Get(CurrentDate));"Week before";" "
)
& "¶" &
Case(
Month(yourItemDate) = Month(Get(CurrentDate)) and Year(yourItemDate) = Year(Get(CurrentDate));"Actual month";
Month(yourItemDate) = Month(Get(CurrentDate) - 7) and Year(yourItemDate) = Year(Get(CurrentDate));"Previous month";" "
)
& "¶" &
Case(
Year(yourItemDate) = Year(Get(CurrentDate));"Current year";
Year(yourItemDate) = (Year(Get(CurrentDate)) - 1);"Year before";
"Prior to last year"
)
You have to fidle a little bit with the Month section to have it - 12 months.
Make a script (find Date) along these lines:
Set Error Capture (On)
Allow User Abort (Off)
Freeze Window
Enter Find Mode ()
Go to Layout (yourLayout)
Insert From Index (Select;yourLayout::findDate)
If
(IsEmpty(yourLayout::findDate)
Enter Browse Mode
Go to layout (Original Layout)
Halt Script
End If
Perform Find()
Tweak your script with some messages tothe user for no records found, with Get(LastError) function etc, and redirect thesystem to an appropriate layout for 1 record, more than 1 record etc.
Now you can find all the records in a timeframe;Today, Yesterday, Last(dayName), This Week, Month etc.
By activating the script, it will show you a value list with choices....
Maybe the calc is not 100 %, I didn't test it, just typed it, but you get the idea.
HTH