# Using selected value from list for dynamin sql query

**URL:** <https://forum.inductiveautomation.com/t/using-selected-value-from-list-for-dynamin-sql-query/12327>\
**Category:** Ignition\
**Created:** [November 4, 2016, 12:16pm UTC](https://forum.inductiveautomation.com/t/using-selected-value-from-list-for-dynamin-sql-query/12327 "2016-11-04T12:16:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwagner](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bwagner](https://forum.inductiveautomation.com/u/bwagner)\
**Post date:** [November 4, 2016, 12:16pm UTC](https://forum.inductiveautomation.com/t/using-selected-value-from-list-for-dynamin-sql-query/12327/1 "2016-11-04T12:16:36Z")

</div>

I have a table that I am using a query to get the data. I want to be able to use WHERE with the value coming from a list. I am very new at this and would appreciate any help. Thanks.

SELECT schedBatch,orderNo,lineNo,seqNo,cartBin,itemNo,description,length,cutQty,totQty,completed  
FROM tigerData  
WHERE schedBatch = {Root Container.List.data}[{Root Container.List.selectedIndex}, 0]

---

<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:** [November 4, 2016, 2:05pm UTC](https://forum.inductiveautomation.com/t/using-selected-value-from-list-for-dynamin-sql-query/12327/2 "2016-11-04T14:05:50Z")

</div>

Within a SQL query you can only use string substitution with braces, not the full expression syntax. So the subscripts with brackets aren’t understood. You’ll have to use a custom property that executes the expression you want, resulting in a string. Then use that property in the SQL.

---

<div class="post-metadata">

**Author:** ![bwagner](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bwagner](https://forum.inductiveautomation.com/u/bwagner)\
**Post date:** [November 14, 2016, 10:16pm UTC](https://forum.inductiveautomation.com/t/using-selected-value-from-list-for-dynamin-sql-query/12327/3 "2016-11-14T22:16:11Z")

</div>

Thank you that worked
