Report Startdate

I have a report scheduled to run daily at 2:30am. The StartDate parameter is

dateArithmetic(now(), -20, "hour")

This works great for showing data starting at 6;30am the previous day but the customer would like to set the time for StartDate from the screen. I can see how to allow them a selection for date and time but that would require their input every day. How do I pass just the selected time to the StartDate parameter without having to pick the date every day?

Ignition Platform 8.1.29

Reporting Module 6.1.29

You want to allow your user to be able to set the time themselves, and trigger the report every day at this time ?

Can you use a tag or query in the report scheduler ? I'm not super familiar with the report module...

The report schedule runs the report every day at 2:30am. The StartDate parameter is used in the queries I run for the report.

Instead of using the Report Scheduler, create a Project Script that calls to execute and distribute the report with the parameters as needed.

Then you can allow the users to set a tag with the configured time that they would like to run the report, with no need to set it daily as it will be persistent.

Set up a Scheduled Gateway Event to run the report at the regularly scheduled time, using either a hard programmed time, or a customer supplied one.

Sorry, I don't understand. I don't need to change when the report is generated, 2:30am is static, every day. I can write to the parameter used in my report but I don't understand how to enter time without having to update the date every day. All of these queries use StartDate

I don't understand either.

If you have a scheduled action at 2:30, what are you intending to do with the user's provided start time?
If it's a scheduled action, it's going to use whatever parameter is supplied in the schedule definition/the default value expression for the parameter.

It seems like you might have two different, exclusive use cases:

  1. Run a scheduled report at 2:30 AM with a start date of -20 hours.
  2. Run a report with an arbitrary start date.

The way to do #2 is to use scripting, or one of the report viewer components available in Vision or Perspective and provide your own custom start date parameter value. Adding that functionality will not affect your scheduled report, if that's what you're concerned about?

1 Like

The report schedule tells the report when to generate a report. The queries ran to collect the data use the parameter StartDate for the start time of data. I need to run a scheduled report that takes a user supplied start time to be used by the queries . StartDate is not when the report is generated. Instead of "Now() -20 hours" I need to just put in a time from a tag without having to pick a date

You'll need to use scripting to do this.

You can use a Gateway Scheduled Event to execute the script at the desired scheduled time, while pulling in the tag value of the user supplied date.

I'm still not sure how to ask the question. The report schedule doesn't need to change. My issue is how to enter a time in to a tag (just hour and minutes) to be used in a query. When using Now() can I use a tag as a variable instead of -20 hours, -30 minutes? If so where can I see an example?

This is a weird pattern, to me.
Why not allow users to get a report with whatever date they specify, right then and there? Rather than (apparently) having them wait until 2:30 rolls around to then get a report with the date they specified.

1 Like

Report parameters are just expressions. So you use curly braces to refer to tags, just like you can everywhere else.
dateArithmetic(now(), -20, "hour")
dateArithmetic(now(), {path/to/hours/tag}, "hour")

1 Like

I'm not suggesting that you change the schedule (a.k.a. the time when the report is executed). Just what executes that report.

Sounds like there is a daily report that is generated automatically and is waiting for everyone when they arrive for the morning meeting.

The StartOfDayTime is configurable at the facility. Some sites start their day at 6am, some at midnight, some at 8am.
Maybe some sites change when first shift starts based on turkey season, deer season, etc.
So there would be an admin screen to set up the StartOfDayTime, ShiftCount, ShiftStartTime[array], ShiftLengthInMinutes[array], etc.

The Date part of the StartDate is always yesterday. The Time part is always the StartOfDayTime.

That's a reasonable use case to me.

Or maybe the StartOfDayTime is to correct a mismatch between local time and UTC... which would not be my approach to correct that.

Or maybe I have misread the thread.

1 Like

That looks like what I need. I'll give it a try as soon as I get the PC back. Thank you.

I have a way for them to specify a start and end time report with a report viewer in the Perspective screen. they don't really use it.. The report I'm asking about runs every night between shifts and gets saved as a pdf. It's a production report for the prior day. They run 2 shifts but sometimes the 1st shift starts at 6 or 6:30 or whenever.

I have a similar report that allows the StartDate to be changed.

I created two memory tags with paths of [default]report/StartHour and [default]report/StartMinute.

On a screen I have 2 Numeric Entry boxes. One box value is bound to the StartHour memory tag, the other is bound to the StartMinute memory tag.
I also used the Numeric Entry box input bounds for "hour" from 1 to 23, and for "minute" with input bounds from 1 to 59... This way they can change the hour and minute memory tags on the screen for when the Start of the report is run.
the report still runs at the same time each day based on the schedule (yours is at 2:30am). The StartDate parameter then needs to be changed to reference the tags instead of using dateArithmetic(now(), -20, "hour")

To use the tags simply put the tag path in curly brackets using the following expression

1 Like

Thank y'all.