# Dynamically update table based on selection from drop-down in perspective

**URL:** <https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890>\
**Category:** Ignition\
**Tags:** ignition80, scripting, ignition81, perspective\
**Created:** [July 14, 2022, 7:08am UTC](https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890 "2022-07-14T07:08:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Killmonger](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Killmonger](https://forum.inductiveautomation.com/u/Killmonger)\
**Post date:** [July 14, 2022, 7:08am UTC](https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890/1 "2022-07-14T07:08:14Z")

</div>

Hi everyone.

I am new to ignition and am facing a problem. So i have 10 tag folders of 10 machines containing 10+ tags each which are live and have their history stored. Now, i want to populate my table(which will contain other tags…let’s say some temperature values, etc) based on selection of machine in the drop down. I also want to add a date time selection component wherein I want to want my table to populate the machine from the drop down and also in the datetime range that i select in the datetime selection component.

Help will be much appreciated.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 14, 2022, 7:16am UTC](https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890/2 "2022-07-14T07:16:37Z")

</div>

1. Create a named query to get the basic information you require for one machine. Test it to check it works.
2. Add parameters to the query so that you can have the query modified based on input parameters. (Read the documentation warnings about using QueryStrings.) Value parameters are safe and can be added to the WHERE clause using the `:paramname` syntax. Test this to check that it works.
3. Create your dropdowns with the parameters for the query.
4. Create a binding on the table data. Select _Query_ and your named query. For each of the _fx_ values bind them to the relevant dropdown’s `props.value`.

Have fun.

---

<div class="post-metadata">

**Author:** ![Killmonger](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@Killmonger](https://forum.inductiveautomation.com/u/Killmonger)\
**Post date:** [July 14, 2022, 9:57am UTC](https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890/3 "2022-07-14T09:57:22Z")

</div>

Hi there…  
I am not storing the values back in a SQL database. I am storing it in PostGres. And i exactly don’t know where the tags are historically stored. Till now i fetch the tags history by using scripting, tag history calculations method. Can you suggest some other way. Also, i think my question was not that clear. I’ll rephrase it.

So i have 10 machines, with let’s say 5 tags each, all of them have history enabled. These 5tags are stored under each different machine name tag folder. Now…what I want is that…

I want to populate my table component in perspective which will contain those 5 tag values as 5 columns. And now i have my drop down which contains 10 machines. I basically want to populate these 5 columns in my table component according to the selection of machines that i make in in the drop down. And if possible if i can incorporate a date time component like the drop-down so that my table shows values of certain selected machines for a certain time period…

I hope i am clear…can you now suggest?

---

<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:** [July 14, 2022, 12:19pm UTC](https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890/4 "2022-07-14T12:19:32Z")

</div>

> [@Killmonger](#):
>
> PostGres

This is SQL. In fact, its proper name is PostgreSQL. "SQL Server" is commonly understood to mean "Microsoft SQL Server", but "SQL" is a brand-independent term.

🙁

/pedantry

---

<div class="post-metadata">

**Author:** ![weixionglichina](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weixionglichina/32/10650_2.png) [@weixionglichina](https://forum.inductiveautomation.com/u/weixionglichina)\
**Post date:** [July 15, 2022, 1:21am UTC](https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890/5 "2022-07-15T01:21:47Z")

</div>

You need to build a [where] string by dropdownsd dymanically and pass your where to sql query as parameter

---

<div class="post-metadata">

**Author:** ![craigb](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@craigb](https://forum.inductiveautomation.com/u/craigb)\
**Post date:** [July 15, 2022, 4:33am UTC](https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890/6 "2022-07-15T04:33:02Z")

</div>

Something like… (Un Tested and this is MYSQL, sounds like it will differ for Postgre)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/c/0c2032be4b1b51d2dd6e69a0028c589d6204988c.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 15, 2022, 8:13am UTC](https://forum.inductiveautomation.com/t/dynamically-update-table-based-on-selection-from-drop-down-in-perspective/61890/7 "2022-07-15T08:13:12Z")

</div>

- _FromDate_ and _ToDate_ should be **Value** type.
- Data Type should be **Date**.
- In the query they should be written as `:FromDate` and `:ToDate`.
