# Dynamic change of named query for TimeSeries Chart

**URL:** <https://forum.inductiveautomation.com/t/dynamic-change-of-named-query-for-timeseries-chart/78189>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [August 22, 2023, 4:49am UTC](https://forum.inductiveautomation.com/t/dynamic-change-of-named-query-for-timeseries-chart/78189 "2023-08-22T04:49:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Learner\_Ignition](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@Learner\_Ignition](https://forum.inductiveautomation.com/u/Learner_Ignition)\
**Post date:** [August 22, 2023, 4:49am UTC](https://forum.inductiveautomation.com/t/dynamic-change-of-named-query-for-timeseries-chart/78189/1 "2023-08-22T04:49:54Z")

</div>

Hi,  
I am trying to change Named Query dynamically in Timeseries chart from a dropdwon selection.

I had created a view in MySQL with columns as tagid, intvalue, floatvalue, t\_stamp, ist\_datetime, utc\_datetime.  
and created 2 Named query in Ignition as 1) ist\_datetime, intvalue and 2) utc\_datetime, intvalue.

On timeseries chart both namedquery works fine.  
I had created a dropdown to switch between IST and UTC named query so same should be reflected in timeseries chart and other places but not able to find a way to do this.

Thanks

---

<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:** [August 22, 2023, 5:11am UTC](https://forum.inductiveautomation.com/t/dynamic-change-of-named-query-for-timeseries-chart/78189/2 "2023-08-22T05:11:37Z")

</div>

A named query binding can't dynamically change its named query. You can do this using the scripting function [system.db.runNamedQuery](https://docs.inductiveautomation.com/display/DOC81/system.db.runNamedQuery). Use a property binding to you dropdown value, then use a scripting transform to run you named query based on the selection and return the dataset.

---

<div class="post-metadata">

**Author:** ![Learner\_Ignition](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@Learner\_Ignition](https://forum.inductiveautomation.com/u/Learner_Ignition)\
**Post date:** [August 22, 2023, 6:46am UTC](https://forum.inductiveautomation.com/t/dynamic-change-of-named-query-for-timeseries-chart/78189/3 "2023-08-22T06:46:04Z")

</div>

Thanks alot
