# Reporting: Dynamic chart timespan

**URL:** <https://forum.inductiveautomation.com/t/reporting-dynamic-chart-timespan/60010>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [May 25, 2022, 2:17pm UTC](https://forum.inductiveautomation.com/t/reporting-dynamic-chart-timespan/60010 "2022-05-25T14:17:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_De\_Schutter](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@Kenneth\_De\_Schutter](https://forum.inductiveautomation.com/u/Kenneth_De_Schutter)\
**Post date:** [May 25, 2022, 2:17pm UTC](https://forum.inductiveautomation.com/t/reporting-dynamic-chart-timespan/60010/1 "2022-05-25T14:17:25Z")

</div>

Hi all,

We have a database table (traceability) that contains a single row of data for every piece we manufacture. This table contains batch number, timestamp when the manufacturing started and when it ended and…

In our report we would like to print a row of data from the traceability table and include the matching time series graph for that particular piece and this for every piece of the requested batch.

So far we managed to;  
The user passes the batch number to the parameters of the report.  
The query is made and returns one row on every page.  
The time series graph we made uses the historian datasource with parameters {StartBatch} and {EndBatch}

Needless to say, the chart is repeated every page with the full timespan from {StartBatch} to {EndBatch}

Is there a way to link the {StartBatch} and {EndBatch} parameters directly to the database table fields that contain the actual start and end time?

Best regards,  
Kenneth

---

<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:** [May 25, 2022, 2:57pm UTC](https://forum.inductiveautomation.com/t/reporting-dynamic-chart-timespan/60010/2 "2022-05-25T14:57:48Z")

</div>

I would uses a script data source in the report to extract the appropriate subsets of the historion dataset and attach them to the traceability dataset as child keys (nested). Then you can use these child keys in the per-piece chart. This topic should help you do this:

> [@Report with Scripted Nested Data](https://forum.inductiveautomation.com/t/report-with-scripted-nested-data/11801):
>
> The report datasource scripting examples explain how to access the nested data in another key for use constructing a custom dataset. What I don’t see is how to construct nested data that would be suitable for use with a child table in a table group. I have a parent dataset that I’m constructing via script due to annoying limitations of an ancient SQL Server 2000 instance. I need a subquery for each row that could be done with a normal query, but there’s no way to add a regular subquery to a s…

---

<div class="post-metadata">

**Author:** ![Kenneth\_De\_Schutter](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@Kenneth\_De\_Schutter](https://forum.inductiveautomation.com/u/Kenneth_De_Schutter)\
**Post date:** [May 30, 2022, 7:40am UTC](https://forum.inductiveautomation.com/t/reporting-dynamic-chart-timespan/60010/3 "2022-05-30T07:40:11Z")

</div>

Thanks for your reply Pturmel, I will give it a go and get back to you.
