BizzyLizzy
Technical User
We have a report that runs 3 times a day. At the moment this is being run manually with the staff member inputing date and time parameters required. Eg. If the report is being run at 6.00am today then the parameters would be yesterdays date and the time set at 14.00. This displays all data from 14.00 yesterday up to 6.00am today. This report then gets run again at 9.00 am for all data between 6 and 9, then run again at 14.00 for all data from 9am to 14.00.
The problem we now have is that we are in the process of automating the reports and scheduling to email and I would like the report to pick up the correct data depending on when it is being run (ie. 6am 9am and 2pm). I have tried the following but have so far failed to make it work.
if CurrentDateTime = CDateTime (1900, 01, 01, 06, 00, 00) then DateAdd ('h',-16,CurrentDateTime) else
if CurrentDateTime = CDateTime (1900, 01, 01, 09, 00, 00) then DateAdd ('h',-3,CurrentDateTime) else
if CurrentDateTime = CDateTime (1900, 01, 01, 14, 00, 00) then DateAdd ('h',-5,CurrentDateTime)
I am probably being completely thick here but I just cant seem to get my head around it.
I hope somebody can help as this is driving me nuts!!
We are running CR 8.5 against MS SQL database.
Lizzy
The problem we now have is that we are in the process of automating the reports and scheduling to email and I would like the report to pick up the correct data depending on when it is being run (ie. 6am 9am and 2pm). I have tried the following but have so far failed to make it work.
if CurrentDateTime = CDateTime (1900, 01, 01, 06, 00, 00) then DateAdd ('h',-16,CurrentDateTime) else
if CurrentDateTime = CDateTime (1900, 01, 01, 09, 00, 00) then DateAdd ('h',-3,CurrentDateTime) else
if CurrentDateTime = CDateTime (1900, 01, 01, 14, 00, 00) then DateAdd ('h',-5,CurrentDateTime)
I am probably being completely thick here but I just cant seem to get my head around it.
I hope somebody can help as this is driving me nuts!!
We are running CR 8.5 against MS SQL database.
Lizzy