Search by Employee ID or Employee Name in the same Search/Input Field


I would like to ask how to search a record by either Employee ID or Employee Name on the same Search/Input Field?

I used the filter in the preparation:

SyntaxEditor Code Snippet

EmployeeName like "%" + SearchName + "%" or SearchName = "" or EmployeeId = IntegerToIdentifier(TextToInteger(SearchName))

the searching for employee id works fine, but when i search for the name it gives me "Error executing query"

Thanks in advance


Hello Miguel,

I think the problem lies here: 


When you convert a number to string there is no issue, but the same cannot be said for converting a string/text to integer.

For your scenario I think the best solution would be to have 2 queries split by a condition checking if the SearchName is an integer:


Then for True branch query

EmployeeId = IntegerToIdentifier(TextToInteger(SearchName))

And for the False branch query

EmployeeName like "'%" + SearchName + "%'" or SearchName = ""

Hope this helps!

- Emman


Thanks Emman, It works :)