# Search inside table result

**URL:** <https://forum.inductiveautomation.com/t/search-inside-table-result/21444>\
**Category:** Ignition\
**Tags:** ignition79, database\
**Created:** [December 17, 2018, 9:25am UTC](https://forum.inductiveautomation.com/t/search-inside-table-result/21444 "2018-12-17T09:25:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [December 17, 2018, 9:25am UTC](https://forum.inductiveautomation.com/t/search-inside-table-result/21444/1 "2018-12-17T09:25:49Z")

</div>

I have table which get data from DB based on query . i needed to filler data result on that table based on text entered in text filed .  
Means ,Search on the result of the query .as per below i need to enter (TestRow17) and once press entered . table will be updated and showing only all rows have same value

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/ce827a20e2ba4c9cb1f8663f681f72066a959f79.JPG)

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [December 17, 2018, 9:57am UTC](https://forum.inductiveautomation.com/t/search-inside-table-result/21444/2 "2018-12-17T09:57:00Z")

</div>

The easiest is probably to use a script for this:

- Define the query on a custom property on the text field (instead of directly on the data property of the table)
- Use a “propertyChange” script on that text field; execute the script whenever the “text” property, or your custom dataset changes
- Loop over the dataset, and copy wanted rows to a new dataset
- Write the dataset to the table

---

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [December 17, 2018, 10:31am UTC](https://forum.inductiveautomation.com/t/search-inside-table-result/21444/3 "2018-12-17T10:31:38Z")

</div>

Why don’t you modify your query?  
For example, if your query is `SELECT * FROM yourTable`,  
change it with `SELECT * FROM yourTable WHERE Col2 LIKE '%{Root Container.Text Field.text}'`  
So it will filter on Col2 and if nothing is specified inside the TextField you’ll see all the results.

---

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [December 17, 2018, 10:34am UTC](https://forum.inductiveautomation.com/t/search-inside-table-result/21444/4 "2018-12-17T10:34:53Z")

</div>

Already did it . but due to certain need . first we need to see the result based on time after that we need to search on certain data.  
this why i looking for search on the result not run new query .

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [December 17, 2018, 10:50am UTC](https://forum.inductiveautomation.com/t/search-inside-table-result/21444/5 "2018-12-17T10:50:56Z")

</div>

If the issue isn’t a performance issue (f.e. if you have performance problems with the DB, and want to use caching), then including it in the query is the better option indeed.

You can easily search on multiple fields by combining them with `AND` and `OR` as needed.

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [December 17, 2018, 11:30am UTC](https://forum.inductiveautomation.com/t/search-inside-table-result/21444/6 "2018-12-17T11:30:19Z")

</div>

> [@Sanderd17](#):
>
> You can easily search on multiple fields by combining them with AND and OR as needed.

Or use concatenation in the WHRE clause, e.g.

```auto
SELECT *
FROM some_table
WHERE YOUR_TIME_BETWEEN_CONDITION AND
CONCAT_WS('_', filterCol1, filterCol2, filterCol3) LIKE CONCAT('%', YOUR_FILTER_VALUE, '%s')

```

Works with Microsoft SQL and MySQL don't know about other db's. The `CONCAT_WS` function can be replaced with a normal `CONCAT` if not supported.

The seperator in `CONCAT_WS` should be replaces with a non-valid search char.
