# SQL Queries in templates that use Template Parameters

**URL:** <https://forum.inductiveautomation.com/t/sql-queries-in-templates-that-use-template-parameters/5560>\
**Category:** Ignition\
**Created:** [December 11, 2012, 3:19pm UTC](https://forum.inductiveautomation.com/t/sql-queries-in-templates-that-use-template-parameters/5560 "2012-12-11T15:19:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![scicco](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@scicco](https://forum.inductiveautomation.com/u/scicco)\
**Post date:** [December 11, 2012, 3:19pm UTC](https://forum.inductiveautomation.com/t/sql-queries-in-templates-that-use-template-parameters/5560/1 "2012-12-11T15:19:58Z")

</div>

Hello,

I have several charts inside a template. The properties of those charts’ data sources are SQL queries that use a Template parameter as part of the query. When I add an instance of the template to a window, it will temporarily flicker the data in the chart to whatever parameter I used in the actual template designer, ignoring the value given to the instance on the main window. This behavior stops if I turn the polling off but then I wouldn’t see the charts update.

The following screenshots hopefully illustrate this a little better. The following query should use whatever value I give the instance for BU\_ID. But the data will temporarily change to BU\_ID = 1 because that is the value in the template designer.

I’m sure I missed a setting somewhere. Thanks in advance as this has been driving me crazy!

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/eb77a8a02689a8e7ebdd5609bdf6d7f03f2bdca0.png)  
  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/cabf064800bdbed9a09eb79ad127f2ea216100c6.png)

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [December 11, 2012, 3:28pm UTC](https://forum.inductiveautomation.com/t/sql-queries-in-templates-that-use-template-parameters/5560/2 "2012-12-11T15:28:28Z")

</div>

Do you ever get a screen flash like BU\_ID = 1 (from the template settings) in the Ignition Client or is this a Designer only problem?

---

<div class="post-metadata">

**Author:** ![scicco](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@scicco](https://forum.inductiveautomation.com/u/scicco)\
**Post date:** [December 11, 2012, 4:23pm UTC](https://forum.inductiveautomation.com/t/sql-queries-in-templates-that-use-template-parameters/5560/3 "2012-12-11T16:23:31Z")

</div>

It’s actually only in the client. The designer doesn’t flicker at all. The instance’s BU\_ID stays the same when I monitor it in the designer.

And it’s only in the data properties of the charts that I’m seeing this. I have assigned the value of the template parameter to a simple label and that doesn’t change.

---

<div class="post-metadata">

**Author:** ![dave.fogle](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dave.fogle](https://forum.inductiveautomation.com/u/dave.fogle)\
**Post date:** [December 20, 2012, 5:21pm UTC](https://forum.inductiveautomation.com/t/sql-queries-in-templates-that-use-template-parameters/5560/4 "2012-12-20T17:21:30Z")

</div>

I'm going to see if I can mock this up here. There is a ticket in our system regarding a similar situation. In that case a SQL query binding using a UDT property not a Template property. I'll see if I can make some headway on recreating this issue and get back to you.
