# Table with SQL list and variable refers to the id list

**URL:** <https://forum.inductiveautomation.com/t/table-with-sql-list-and-variable-refers-to-the-id-list/43783>\
**Category:** Ignition\
**Tags:** perspective, database\
**Created:** [February 24, 2021, 1:06pm UTC](https://forum.inductiveautomation.com/t/table-with-sql-list-and-variable-refers-to-the-id-list/43783 "2021-02-24T13:06:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OscarLucas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscarlucas/32/6417_2.png) [@OscarLucas](https://forum.inductiveautomation.com/u/OscarLucas)\
**Post date:** [February 24, 2021, 1:06pm UTC](https://forum.inductiveautomation.com/t/table-with-sql-list-and-variable-refers-to-the-id-list/43783/1 "2021-02-24T13:06:00Z")

</div>

Hello  
I am doing in ignition perspective a table list with stations. I have to make a table with 2 colums, 1 name station, 2 status of the station.  
I have the querry to the name station, but i don´t know how to get the real time status of the station.  
How can ignition do that?  
Should i use a script?  
Query?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9f3cddc66eab979c2466cd45718b3c5f3fa4e00f.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 24, 2021, 1:41pm UTC](https://forum.inductiveautomation.com/t/table-with-sql-list-and-variable-refers-to-the-id-list/43783/2 "2021-02-24T13:41:05Z")

</div>

Where is the Station Status coming from?

---

<div class="post-metadata">

**Author:** ![OscarLucas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscarlucas/32/6417_2.png) [@OscarLucas](https://forum.inductiveautomation.com/u/OscarLucas)\
**Post date:** [February 24, 2021, 5:21pm UTC](https://forum.inductiveautomation.com/t/table-with-sql-list-and-variable-refers-to-the-id-list/43783/3 "2021-02-24T17:21:30Z")

</div>

From 20 UDT tags

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 24, 2021, 6:15pm UTC](https://forum.inductiveautomation.com/t/table-with-sql-list-and-variable-refers-to-the-id-list/43783/4 "2021-02-24T18:15:36Z")

</div>

There are several ways to accomplish this, but they pretty much all boil down to these steps:

1. Query the database for the list of stations
2. Read the status from the tags
3. Combine those two results into a dataset
4. Move that dataset into the table.

For instance, you could write a gateway timer script that does steps 1-3 and stores the resultant dataset in a memory tag, then bind that tag to the table’s data property.
