# Report Startdate

**URL:** <https://forum.inductiveautomation.com/t/report-startdate/78290>\
**Category:** Ignition\
**Created:** [August 23, 2023, 2:33pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290 "2023-08-23T14:33:50Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddie\_johnson](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eddie\_johnson](https://forum.inductiveautomation.com/u/eddie_johnson)\
**Post date:** [August 23, 2023, 2:33pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/1 "2023-08-23T14:33:50Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 23, 2023, 2:39pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/2 "2023-08-23T14:39:20Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![eddie\_johnson](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eddie\_johnson](https://forum.inductiveautomation.com/u/eddie_johnson)\
**Post date:** [August 23, 2023, 2:51pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/3 "2023-08-23T14:51:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 23, 2023, 3:20pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/4 "2023-08-23T15:20:24Z")

</div>

Instead of using the Report Scheduler, create a Project Script that calls `system.report.executeAndDistribute()` 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.

---

<div class="post-metadata">

**Author:** ![eddie\_johnson](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eddie\_johnson](https://forum.inductiveautomation.com/u/eddie_johnson)\
**Post date:** [August 23, 2023, 3:46pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/5 "2023-08-23T15:46:33Z")

</div>

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**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/d/5d405f02fb9e0462449f455c580095b4c97fd7b5.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 23, 2023, 3:51pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/6 "2023-08-23T15:51:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![eddie\_johnson](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eddie\_johnson](https://forum.inductiveautomation.com/u/eddie_johnson)\
**Post date:** [August 23, 2023, 4:01pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/7 "2023-08-23T16:01:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 23, 2023, 4:18pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/8 "2023-08-23T16:18:55Z")

</div>

> [@eddie\_johnson](#):
>
> **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.

---

<div class="post-metadata">

**Author:** ![eddie\_johnson](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eddie\_johnson](https://forum.inductiveautomation.com/u/eddie_johnson)\
**Post date:** [August 23, 2023, 4:23pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/9 "2023-08-23T16:23:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 23, 2023, 4:24pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/10 "2023-08-23T16:24:42Z")

</div>

> [@eddie\_johnson](#):
>
> I need to run a scheduled report that takes a user supplied start time to be used by the queries

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.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 23, 2023, 4:25pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/11 "2023-08-23T16:25:59Z")

</div>

> [@eddie\_johnson](#):
>
> 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?

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

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 23, 2023, 4:29pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/12 "2023-08-23T16:29:21Z")

</div>

> [@eddie\_johnson](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![Tim\_Carlton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim_carlton/32/52835_2.png) [@Tim\_Carlton](https://forum.inductiveautomation.com/u/Tim_Carlton)\
**Post date:** [August 23, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/13 "2023-08-23T16:34:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![eddie\_johnson](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eddie\_johnson](https://forum.inductiveautomation.com/u/eddie_johnson)\
**Post date:** [August 23, 2023, 4:40pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/14 "2023-08-23T16:40:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eddie\_johnson](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eddie\_johnson](https://forum.inductiveautomation.com/u/eddie_johnson)\
**Post date:** [August 23, 2023, 5:01pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/15 "2023-08-23T17:01:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ken\_Hass](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken_hass/32/51454_2.png) [@Ken\_Hass](https://forum.inductiveautomation.com/u/Ken_Hass)\
**Post date:** [August 23, 2023, 5:12pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/16 "2023-08-23T17:12:43Z")

</div>

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  
setTime(addDays(now(),-1),{[default]report/StartHour},{[default]report/StartMinute},0)

---

<div class="post-metadata">

**Author:** ![eddie\_johnson](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@eddie\_johnson](https://forum.inductiveautomation.com/u/eddie_johnson)\
**Post date:** [August 23, 2023, 7:22pm UTC](https://forum.inductiveautomation.com/t/report-startdate/78290/17 "2023-08-23T19:22:22Z")

</div>

Thank y'all.
