# Search Text Field / Syntax help

**URL:** <https://forum.inductiveautomation.com/t/search-text-field-syntax-help/30737>\
**Category:** Ignition\
**Created:** [December 16, 2019, 6:16pm UTC](https://forum.inductiveautomation.com/t/search-text-field-syntax-help/30737 "2019-12-16T18:16:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![csanyia](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@csanyia](https://forum.inductiveautomation.com/u/csanyia)\
**Post date:** [December 16, 2019, 6:16pm UTC](https://forum.inductiveautomation.com/t/search-text-field-syntax-help/30737/1 "2019-12-16T18:16:27Z")

</div>

I have a main table, with many text fields that can be written to the table. I’m attempting to add a filter to the column, I am attempting to achieve this by adding a WHERE tag = {Root Container.Search.search}

The " Search" custom property is to either be null if search = empty , or to write the rest of the where string AND tag = Container.Search.text} .

Two main issues, 1.) I do not know the proper syntax to write the string, it keeps printing the {root container.Search.txt} versus, what is in the text box,  
2.) Not even sure if this idea will work for a search bar.

Code of the custom property:  
if({Root Container.Search.text}="","",“AND e.tag = {Root Container.Search.text}”)

---

<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:** [December 17, 2019, 12:38am UTC](https://forum.inductiveautomation.com/t/search-text-field-syntax-help/30737/2 "2019-12-17T00:38:14Z")

</div>

Im basing my answer in perspective but the same applies to vision, I’m also assuming your search box is a text field box.

This is how I do it to enable wild cards on the search.

On the text field box create 2 custom properties. One called ‘whereclaus’ and one called ‘keyword’

The whereclaus expression is (Description is my database field)

```auto
if ({this.custom.Keyword}='',
	"Description >= ''",
	concat("Description LIKE '",{this.custom.Keyword},"'")
	)

```

The keyword expression is

```auto
{this.props.text}

```

but it has a transform expression of

```auto
'%'+{value}+'%'

```

Now, in your sql query / Named query (in my case) I add ‘Description’ as a Query String  
and use the following as an example…

```auto
SELECT DATE_FORMAT(Date, "%m-%d-%Y") AS 'Date', 
RequestNumber As 'Request Number',
PONumber AS 'P/O',
ProjectNumber As 'Project No',
Supplier,
Requester,
DeliverTo As 'Deliver To',
PartNumber As 'Part No',
Description,
Qty,
PriceEach As 'Cost Each',
TotalCost As 'Line Cost'
From order_requests
WHERE Status = 'Ordered'
AND {Project}
AND {Supplier}
AND {PartNumber}
AND {ReqNumber}
AND {Description}
AND {Classification}
Order by id Desc

```

With the %% as part of the expression, as soon as you type a letter it will start matching everything with that character.

I forgot to add, Dont forget to go back to your table query and add the whereclaus you just created on the text field in the table parameters.
