Search filter by name and surname
Question

Hi guys, im trying to build a filter to search on an aggregate by name or surname!


My code is this but doesnt work 


SyntaxEditor Code Snippet

DirecaoProvedoria.NomeCliente like "%" + NomeCliente + "%" + NomeCliente 
Solution
DirecaoProvedoria.NomeCliente like "%" + NomeCliente + "%"

Hey,

Assuming you have only one Search Input where you store its value in the variable NomeCliente and you store the whole name in DirecaoProvedoria.NomeCliente, this should be enough.

Hi João,

To better assist you, could you please say what your table attributes are in 

DirecaoProvedoria 

and what do they mean? Also, what are your query string parameters and what do they mean?


Let's say your table looks like this:

User.name

User.surname


And your query string is called 'query'.


Then your filter could look like this:

User.name like "%" + query + "%" or User.surname like "%" + query + "%"

Otherwise, if your table is setup to include both first name and last name like this:


User.name

And your query string is either 'name' or surname'


Then your filter could look like this:

User.name like '%" + name + "%" or User.name like "%" + surname + "%"

DirecaoProvedoria.NomeCliente like "%" + Firstname + "%" or
DirecaoProvedoria.NomeCliente like "%" + LastName + "%"

Is this the use case?

Solution
DirecaoProvedoria.NomeCliente like "%" + NomeCliente + "%"

Hey,

Assuming you have only one Search Input where you store its value in the variable NomeCliente and you store the whole name in DirecaoProvedoria.NomeCliente, this should be enough.

USE THIS  SYNTAX 

User.name like "%" + query + "%" and  User.surname like "%" + query + "%"

yes , its works for me

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.