# How to perform a wildcard search and filter across a whole table with Named Query Binding

**URL:** <https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020>\
**Category:** Ignition\
**Tags:** namedqueries, perspective\
**Created:** [October 4, 2023, 3:14pm UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020 "2023-10-04T15:14:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [October 4, 2023, 3:14pm UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/1 "2023-10-04T15:14:56Z")

</div>

I would like to filter the test table below in Perspective by Text Field Input referencing UnitType and IssueType primarily, using a Named Query Binding or other method.

 ![screen4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/9/990faa192b286253e74c20b070b15cf424cfe2ed.jpeg)

This MYSQL query using LIKE works fine in the console but I can't figure out how to reference the wildcard value in Perspective:

```
SELECT * FROM testPivot 
WHERE CONCAT(UnitType, IssueType) 
LIKE '%Comms%' ORDER BY UnitType;

```

How do I dynamically reference the wildcard '%???%' in my named query?

I have tried several different methods with no luck, I basically want this:

```
SELECT * FROM
testPivot
WHERE CONCAT(UnitType, IssueType) LIKE '%TextFieldInput%'	

```

I can filter the table by one input field such as this dropdown but adding additional parameters linked to the same input field doesn't work:

 ![screen2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b5876029e6731e6470a1a30130bf9d1d5ed7a7b4.png)

I have tried this also:

```
SELECT * 
FROM testPivot
WHERE IssueType =:IssueType OR UnitType =:UnitType

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 4, 2023, 3:27pm UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/2 "2023-10-04T15:27:16Z")

</div>

Any reason you don't want to use the table's built-in filter ?  
It will perform a `like %foo%` filter on all columns, so it will filter on both unit type and issue type.

---

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [October 4, 2023, 3:32pm UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/3 "2023-10-04T15:32:28Z")

</div>

It was just a layout idea I was trying, the built in filter is definitely the cleanest way to do it though thanks

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [October 6, 2023, 1:22pm UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/4 "2023-10-06T13:22:00Z")

</div>

I'm not totally sure I understand your question, but ....

You can just replace the search string passed to LIKE with a parameter:

```auto
SELECT * FROM testPivot 
WHERE CONCAT(UnitType, IssueType) 
LIKE :SearchString ORDER BY UnitType;

```

And then call the named query with "%Comms%", for example. If you don't want to have to remember the "%" on the caller, you can use `LIKE CONCAT('%',:SearchString,'%')` in the query and just pass "Comms" instead.

---

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [October 6, 2023, 1:25pm UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/5 "2023-10-06T13:25:25Z")

</div>

That's exactly what I wanted thank you, I just couldn't figure out how to reference the search string

---

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [October 10, 2023, 7:53am UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/6 "2023-10-10T07:53:10Z")

</div>

I found a work around for what I wanted it's not very elegant but it works. I added a hidden 'Select All' column to my table and referenced that in my SELECT query. User can select a distinct issue type or 'Select All' in the drop down to filter the table.

```
SELECT *
FROM testPivot
WHERE (IssueType) LIKE :SearchString
OR (SelectAll) LIKE :SearchString

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 10, 2023, 9:04am UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/7 "2023-10-10T09:04:45Z")

</div>

I'm still not sure why you're not just using the built-in filter.. What's the issue you needed to solve exactly ?

---

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [October 10, 2023, 9:06am UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/8 "2023-10-10T09:06:45Z")

</div>

I am using the built in filter as well for additional filtering, I need to export data afterwards and the dropdown filter is for this

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [October 10, 2023, 1:40pm UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/9 "2023-10-10T13:40:41Z")

</div>

You can get the built-in filter results back for exporting too, take a look at the `filter.results.enable` and `filter.results.data` property on the table.

---

<div class="post-metadata">

**Author:** ![Roisin\_McGuire](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/roisin_mcguire/32/63343_2.png) [@Roisin\_McGuire](https://forum.inductiveautomation.com/u/Roisin_McGuire)\
**Post date:** [October 16, 2023, 7:37am UTC](https://forum.inductiveautomation.com/t/how-to-perform-a-wildcard-search-and-filter-across-a-whole-table-with-named-query-binding/80020/10 "2023-10-16T07:37:31Z")

</div>

Thank you very much, I'll have a play around with that
