# executeAndDistribute Date Range Not Matching

**URL:** <https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715>\
**Category:** Ignition\
**Tags:** ignition81, scripting, reporting\
**Created:** [December 9, 2025, 9:21pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715 "2025-12-09T21:21:01Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [December 9, 2025, 9:21pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/1 "2025-12-09T21:21:01Z")

</div>

I have a report that is configured in a script. The report is generated to a PDF via the system.report.executeAndDistribute() function. This report works in Reports Preview in the Designer:

 ![Screenshot 2025-12-09 160806](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/2/a23e9b226f7342129e5cef56eec8d584940009d2.png)

But when the report is triggered in script, the final PDF has the correct data but the span of the chart doesn’t match the times as the preview does:

 ![Screenshot 2025-12-09 155644](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/9502c9965587ce73937ed31a9cd6058c799b3f4d.png)

I’ve checked everywhere in this forum, and elsewhere online, but I can’t seem to figure out why this happens. I expect it is the difference between the actual report and creating it using executeAndDistribute(). I hope someone here can help.

Below is the script that generates the PDF report:

```python
#Get parameters for the report
kilnNum = event.source.parent.KilnNum
chargeNum = event.source.parent.ChargeNum

startDate = event.source.parent.getComponent('ChargeGraph').startDate

endDate = event.source.parent.getComponent('ChargeGraph').endDate
endDateStr = system.date.format(endDate, "yyyy-MM-dd")

#Configure report name & location
path = "C:\KilnReports\K" + str(kilnNum)
fileName = endDateStr + "_" + str(chargeNum) + "_" + "K" + str(kilnNum)

#Create report
settings = {"path":path, "fileName":fileName, "format":"pdf"}
params = {"KilnNum":kilnNum, "ChargeNum":chargeNum, "StartDate":startDate, "EndDate":endDate}
system.report.executeAndDistribute(path="KilnChargeReport", project="BDK_Kilns", parameters=params, action="save", actionSettings=settings)

```

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [December 11, 2025, 3:01pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/2 "2025-12-11T15:01:34Z")

</div>

Anybody out there???

Surprised not a single reply in 2 days…

Did I offend someone/something? Or am I just supposed to live with this?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2025, 3:04pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/3 "2025-12-11T15:04:00Z")

</div>

Sometimes your post isn't seen, sometimes nobody knows, sometimes nobody has time. The forum is not an official support venue, everybody here is a volunteer, and 99%+ are users and not IA employees.

Give support a call if it's urgent or when your post doesn't get an answer.

---

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [December 11, 2025, 3:14pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/4 "2025-12-11T15:14:07Z")

</div>

Thanks.

You guys have always been prompt, so I was worried it got stuck somewhere.

I have a startup this weekend and I’ll check again next week. If no replies, I’ll try support.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 11, 2025, 3:22pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/5 "2025-12-11T15:22:46Z")

</div>

I saw your post. I didn't have a clue. It happens. 🤣

Consider adding a script inside the report that simply logs the parameters that were supplied. Then you can spot any difference between the two execution methods. (The report viewer still executes the report in the gateway.)

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [December 11, 2025, 3:27pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/6 "2025-12-11T15:27:29Z")

</div>

> [@tbennett.tdc](#):
>
> `path = "C:\KilnReports\K" + str(kilnNum)`

I don’t know this will fix your issue, but this stands out to me - prefix with `r` or use `\\` in your path since `\` is Python’s escape character.

`path = r"C:\KilnReports\K" + str(kilnNum)`

or

`path = "C:\\KilnReports\\K" + str(kilnNum)`

Also, what version are you working with? Can you share more about the report design? What chart type and any scripts attached to it that may be extending the date range? Is this sporadic or every attempt? Do you have any other reports that don’t do this?

> [@tbennett.tdc](#):
>
> Did I offend someone/something?

I find the more you give out the more you get back.

---

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [December 15, 2025, 4:14am UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/7 "2025-12-15T04:14:28Z")

</div>

Thanks for the reply.

> I don’t know this will fix your issue, but this stands out to me - prefix with `r` or use `\\` in your path since `\` is Python’s escape character.
> 
> `path = r"C:\KilnReports\K" + str(kilnNum)`
> 
> or
> 
> `path = "C:\\KilnReports\\K" + str(kilnNum)`

Neither of these suggestions worked.

I am using v8.1.41.

The report uses a Timeseries Chart with 4 tag\_history pens to show historical tags. The chart renders just fine when in the Report Preview in Designer. There are no scripts in the report - just the script that calls the executeAndDistribute function in the actionPerformed event handler configured on a Button that is on a Vision Window. This window also shows the graph on an EasyChart on the same window which also renders just fine. This is the only report in the entire project so far so I have nothing to compare.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [December 15, 2025, 4:17am UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/8 "2025-12-15T04:17:28Z")

</div>

The only parameters that are used in the report are the StartDate and EndDate and they are displayed in text at the top of the report and are always correct.

Thanks for this tip though.

---

<div class="post-metadata">

**Author:** ![william.bowen](https://avatars.discourse-cdn.com/v4/letter/w/8c91f0/32.png) [@william.bowen](https://forum.inductiveautomation.com/u/william.bowen)\
**Post date:** [December 15, 2025, 4:39am UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/9 "2025-12-15T04:39:30Z")

</div>

How do the `StartDate` and `EndDate` parameters get used within your report’s tag history data source? Could you share a screenshot?

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [December 16, 2025, 7:52pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/10 "2025-12-16T19:52:23Z")

</div>

Do you have a different timezone between your Designer and the gateway? The data going to almost exactly 1 hour later would maybe point me to consider that.

Also you have StartDate and then startDate, could the case difference between those be an issue with displaying one in the text at the top but using the other in the parameters.

I really don't know but those two thoughts came to mind to try and help.

---

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [January 13, 2026, 7:16pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/11 "2026-01-13T19:16:10Z")

</div>

Thanks for the questions. I hope this helps clarify how I am producing this report. As you can see below, all values displayed on the report are parameters. The parameters are used to display the values at the top, and the StartDate and EndDate are used for the Historical Date Range.

This is the configuration of the data for the report in Designer:

 ![Screenshot 2026-01-13 140219](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/c/3cd31dacb540b468c7b3075183224296fccd1225.png)

This is the Window running on the Client containing an EasyChart that displays the same data:

 ![Screenshot 2026-01-13 135655](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/f/bf2c6eeef066d8e9856ac285c13c92eec0a7b02e.png)

This is the report in Preview Mode in Designer:

 ![Screenshot 2026-01-13 141222](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/1/5198c9b8d0b97ee25dc3e406c77a7a62a73c9778.png)

Then this is the Report saved as a PDF using “executeAndDistribute”:

 ![Screenshot 2026-01-13 135917](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/c/fcd968bbcd78bc312974aa512a8504f2435d8865.png)

The PDF report does not use the same StartDate and/or EndDate of the parameters.

---

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [January 13, 2026, 8:06pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/12 "2026-01-13T20:06:57Z")

</div>

I know it is not specific to the “executeAndDistribute” script function because I added a “Report Viewer” to a popup window and the report still doesn’t handle the date range properly, and looks just like the PDF that is generated by the script function. This indicates to me that there is an issue with the report, but it displays fine in Preview mode in Designer.

---

<div class="post-metadata">

**Author:** ![william.bowen](https://avatars.discourse-cdn.com/v4/letter/w/8c91f0/32.png) [@william.bowen](https://forum.inductiveautomation.com/u/william.bowen)\
**Post date:** [January 14, 2026, 12:15am UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/13 "2026-01-14T00:15:45Z")

</div>

Hmm, nothing is striking me as incorrect. Have you enabled any the Advanced options on the Tag Historian Query?  
If you willing to DM me an export of the Report and the Vision window I’m happy to take a look at them.

---

<div class="post-metadata">

**Author:** ![Vi\_Quang](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/vi_quang/32/82707_2.png) [@Vi\_Quang](https://forum.inductiveautomation.com/u/Vi_Quang)\
**Post date:** [January 15, 2026, 12:57am UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/14 "2026-01-15T00:57:49Z")

</div>

Charts displayed in Preview have a different PDI than the chart in the output PDFs. This accounts for the differences. As an example, the charts below is the exact same chart with the same data, but different DPI. Note the different increments.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/b/4bf87643390fdf17b7643ee59de4e3c14da6fee6.png)

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

What you need to do is manually set the chart’s range rather than let it decide on its own.

Under `Chart Options > Scripting > Edit Script`

using the following code snippet as a starting point.

`chart.getXYPlot().getDomainAxis().setRange(lowerBound, upperBound);`

In 8.3 when it comes to ranges, this should not be a problem when using vectors (Use Raster is unchecked).

---

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [January 15, 2026, 5:09pm UTC](https://forum.inductiveautomation.com/t/executeanddistribute-date-range-not-matching/112715/15 "2026-01-15T17:09:48Z")

</div>

This solved my issue. I am now forcing the chart range with the following:

```python
def configureChart(data, chart):
	chart.getXYPlot().getDomainAxis().setRange(data['StartDate'], data['EndDate'])

```
