# Ideas on using established data to trend

**URL:** <https://forum.inductiveautomation.com/t/ideas-on-using-established-data-to-trend/70117>\
**Category:** Ignition\
**Tags:** scripting, vision\
**Created:** [February 21, 2023, 3:19pm UTC](https://forum.inductiveautomation.com/t/ideas-on-using-established-data-to-trend/70117 "2023-02-21T15:19:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Blaschuk](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Ben\_Blaschuk](https://forum.inductiveautomation.com/u/Ben_Blaschuk)\
**Post date:** [February 21, 2023, 3:19pm UTC](https://forum.inductiveautomation.com/t/ideas-on-using-established-data-to-trend/70117/1 "2023-02-21T15:19:41Z")

</div>

I'm using Vision... I am trying to establish a dynamic chart so I don't have to lose the use of my old SQL data. I want to chart the previous shift data (6A-6P) by day for a start time one one calendar to the end date on another. I know that there is a "For Loop" in there and I need to create a table using the loop. Then the table is bound to the typical chart(not the easy chart) using the data set. I can make custom properties and such but this data table building is put of my realm of comfort. I don't know how to start the For loop and play with it to get it going. Please help 🙂

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [February 21, 2023, 4:25pm UTC](https://forum.inductiveautomation.com/t/ideas-on-using-established-data-to-trend/70117/2 "2023-02-21T16:25:19Z")

</div>

If the data is in a SQL Table you just have to bind the chart to a query gathering the data from the table.  
Just have the first column be a datetime field and then in the query binding substitute the where clause with values from calendar controls on the window.

 ![ChartBinding](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/f/bfd79e718d7ed900d813359e9bab3d2407d40699.png)

---

<div class="post-metadata">

**Author:** ![Ben\_Blaschuk](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Ben\_Blaschuk](https://forum.inductiveautomation.com/u/Ben_Blaschuk)\
**Post date:** [February 21, 2023, 7:47pm UTC](https://forum.inductiveautomation.com/t/ideas-on-using-established-data-to-trend/70117/3 "2023-02-21T19:47:50Z")

</div>

I'm bad at asking questions apparently... I have a piece of equiplemt that runs on and off over a day. i want to know the how often it runs over a month only on day shift(6a-6p) as a percentage of the shift.  
something like this... then i want to take that table and char it in Ignition. The date range will vary based on the inputs. I need to create the table and then bind the table to the chart. the kicker is making the table as a custom property initially.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/c/dc824e246ae3401438d59d5a90a8525607b327c1.png)

---

<div class="post-metadata">

**Author:** ![Ben\_Blaschuk](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Ben\_Blaschuk](https://forum.inductiveautomation.com/u/Ben_Blaschuk)\
**Post date:** [February 21, 2023, 10:27pm UTC](https://forum.inductiveautomation.com/t/ideas-on-using-established-data-to-trend/70117/4 "2023-02-21T22:27:39Z")

</div>

I found a work around using a tag historian. not exactly what i wanted but i think there is going to be a bit of coding involved. If so, i will have my guy do it. I'm an old god and new tricks are scary 😉
