Leith Hawkins
Leith Hawkins

Reputation: 159

Crystal Report return values for the last week

I am trying to filter a report to return all the data for the last week so that I can send a report to staff for there records for the week.

I have in the past used the same concept to return all records for yesterday. See code below:

if {vwtb_Audit.AUDIT_DATE} = currentdate -1 then "Yesterday"

Else

"Other"

if i use this code I will only return things for 7days ago and it won't allow me to return the other data from the other days in the week.

Upvotes: 1

Views: 3052

Answers (2)

CoSpringsGuy
CoSpringsGuy

Reputation: 1645

{vwtb_Audit.AUDIT_DATE} in Last7days

includes today

{vwtb_Audit.AUDIT_DATE} in lastfullweek

includes last week from Sunday to Saturday

(
{vwtb_Audit.AUDIT_DATE} >= minimum(lastfullweek) + 1
and
{vwtb_Audit.AUDIT_DATE} <= maximum(lastfullweek) + 1
)

includes last week from Monday to Sunday

Upvotes: 2

Leith Hawkins
Leith Hawkins

Reputation: 159

I added this code to a formula which I can then do a select records on.

if {vwtb_Audit.AUDIT_DATE} > dateadd ('d',-7,currentdate) then "lastweek"
else
"other"

and this returned all records from "last week"

Upvotes: 0

Related Questions