Re: Find in a date range



buck.matthew74@xxxxxxxxx wrote:

I want to create a script that will select all records in the past
week, past month, this year.

To find everything for the past seven days:

Set Variable [ $Today; get(currentdate) ]
Enter Find Mode []
Set Field [ DateField; getastext($Today-7) & "..." & getastext($Today) ]
Perform Find []

For the last complete week (Monday thru Sunday), change the Set Field calc to:

let([
x=dayofweek($Today);
start = $Today - (5 + x);
end = $Today - (x - 1) ];
getastext(start) & "..." & getastext(end)
)

Past month:

let([
start = date(month($Today)-1; day($Today); year($Today));
end = $Today ];
getastext(start) & "..." & getastext(end)
)

Last full calendar month:

let([
start = date(month($Today)-1; 1; year($Today));
end = date(month($Today); 1; year($Today))-1 ];
getastext(start) & "..." & getastext(end)
)

I'll let you figure out the year thing.
.