# Alarm notification pipeline Calculated Roster, referencing tag within

**URL:** <https://forum.inductiveautomation.com/t/alarm-notification-pipeline-calculated-roster-referencing-tag-within/36265>\
**Category:** Ignition\
**Created:** [July 1, 2020, 8:06pm UTC](https://forum.inductiveautomation.com/t/alarm-notification-pipeline-calculated-roster-referencing-tag-within/36265 "2020-07-01T20:06:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ijustdunnoaname1](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@ijustdunnoaname1](https://forum.inductiveautomation.com/u/ijustdunnoaname1)\
**Post date:** [July 1, 2020, 8:06pm UTC](https://forum.inductiveautomation.com/t/alarm-notification-pipeline-calculated-roster-referencing-tag-within/36265/1 "2020-07-01T20:06:24Z")

</div>

I’m running a SQL query inside of a Calculated alarm notification roster and I have everything working properly EXCEPT I can only get it to work if I use an actual integer where “udt parameter here” is specified below.

```auto
data = system.db.runQuery("SELECT column_a FROM table_1 WHERE column_b = 3 AND column_c = *udt parameter here*", "DB")

     for row in data:
		    builder.email([row["column_a"]]).add()
		 
		# use the builder object's build() function to create the finished list of data
		userList = builder.build()
		return userList

```

I’ve tried doing a read block:

```auto
faultqv = system.tag.read("[.]/LINES/PARAMS/LINES NUMBER")
	fault = faultqv.value

```

Making the code:

```auto
data = system.db.runQuery("SELECT column_a FROM table_1 WHERE column_b = 3 AND column_c = 'fault' ", "DB")

     for row in data:
		    builder.email([row["column_a"]]).add()
		 
		# use the builder object's build() function to create the finished list of data
		userList = builder.build()
		return userList

```

But that didn’t appear to work properly either.

What can I do to reference the tag value within the “runQuery”? I’m using 8.0.12

---

<div class="post-metadata">

**Author:** ![KMuldoon](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@KMuldoon](https://forum.inductiveautomation.com/u/KMuldoon)\
**Post date:** [July 2, 2020, 12:04am UTC](https://forum.inductiveautomation.com/t/alarm-notification-pipeline-calculated-roster-referencing-tag-within/36265/2 "2020-07-02T00:04:55Z")

</div>

As long as you’re pushing in an integer value into the query string, you should be able to use python’s string interpolation. As an example, using your query, it would look like:

```auto
fault = system.tag.readBlocking(["[.]/LINES/PARAMS/LINES NUMBER"])[0].value

query = "SELECT column_a FROM table_1 WHERE column_b = 3 AND column_c = %d" % (fault)
data = system.db.runQuery(query, "DB")

for row in data:
	builder.email([row["column_a"]]).add()
		 
	# use the builder object's build() function to create the finished list of data
	userList = builder.build()
	return userList

```

(Note: I just assigned the string to the query variable to make it easier to read, you could just put it straight into the .runQuery())
