Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running report based on previous day 1

Status
Not open for further replies.

susanna123

Technical User
Jan 22, 2010
79
CA
hi
I have report that run daily but it is reporting full history everyday instead of just previous day or last 24 hours.

I have a start and end time.

My end time formula looks like this:
Local StringVar dt;
if isnull({AP_FinishedInstances.SI_ENDTIME}) or
trim({AP_FinishedInstances.SI_ENDTIME}) = "" then
dt := "99990909090909" else
dt := {AP_FinishedInstances.SI_ENDTIME};
Local NumberVar yr := ToNumber(dt[1 to 4]);
Local NumberVar mo := ToNumber(dt[5 to 6]);
Local NumberVar dy := ToNumber(dt[7 to 8]);
Local NumberVar hr := ToNumber(dt[9 to 10]);
Local NumberVar mn := ToNumber(dt[11 to 12]);
Local NumberVar sc := ToNumber(dt[13 to 14]);
DateTimeValue (yr, mo, dy, hr, mn, sc)

In the record selection formula i would like to use the end time to capture the last 24 hours.

I have this in record selection which is not returning data correctly:

{AP_FinishedInstances.SI_ENDTIME} = "dd/mm/yyyy"

Thank you
 
For yesterday, use your FORMULA, not the endtime, and set it up like this:

date({@endtime}) = currentdate-1

Or, for the last 24 hours from this moment, use:

{@endtime} in datediff("h",-24,currentdatetime) to currentdatetime

-LB
 
Hi LB

If i use this: date({@endtime}) = currentdate-1

and say the report runs on a weekend, will it account for weekends?

thank you so much
 
No, of course not. You could change it to:

(
if dayofweek(currentdate) = 2, then
date({@endtime}) = currentdate-3 else
date({@endtime}) = currentdate-1
)

-LB
 
Hi LB
thanks for your help.

if i use this: date({@endtime}) = currentdate-1

and if the report runs on monday, it will not pick up the data from saturday/sunday?

but the following will?

(
f dayofweek(currentdate) = 2, then
date({@endtime}) = currentdate-3 else
date({@endtime}) = currentdate-1
)

for example if report runs on sunday, report will pick up data for saturday? and running on saturday pick up data for friday or does the code you provide if report runs on monday pick up data only from the friday but not saturday or sunday?

can you clarify? thks.
 
What do you WANT the report to do? I thought you wanted to pick up only Friday's data if it was Monday. You can see what the formula is doing by simply doing the subtraction.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top