Introducing the all-new TIBCO Community site!

For current users, please click "Sign In" to reset your password and access the enhanced features. If you're a first-time visitor, we extend a warm welcome—click "Sign Up" to become a part of the TIBCO Community!

If you're seeking alternative community sites, explore ibi, Jaspersoft, and Spotfire.

Jump to content

Set an auto update date range


Recommended Posts

Hi All,

Im looking to pull data between 6am on one day to 6am the next day. We call this a 'Production Day'. The report is on scheduler and auto updates every 5 mins, pulling in more data as it becomes available over time.

At the moment, I have to manually set the datesfor the report to populate. However I am now trying to figure out how to set the date range automatically.

I have two document properties called "Start" and "End". I have tried making a data function using R code, however I am finding it difficult to determine the fixed start and end times based off of an expression using Sys.time().

I am hoping to write some code that as system time moves on throughout the day, the start and end times remaincorrect and only change once we move into the next production day.

Any ideas on how to write this bit of code

Kind Regards,

Peter

Link to comment
Share on other sites

Without going into too much details, here's my approach:

Extract the current time and the current date using Sys.time(format....) into two variables.

Then check if the time is before or after 6am. If after 6am use the current date. if before 6am use the previous date (= date - 1). Save this result as string into a new variable 'mydate'.

Then create your startvariableby concatenating 'mydate' with your desired times. Your end variable should be Sys.time() since you can't pull data from the future :)

Convert the start-stringback to datetime format.

Link to comment
Share on other sites

×
×
  • Create New...