jaystack / jaydata

Notice: this library isn't maintained anymore
http://jaydata.org
GNU General Public License v2.0
352 stars 95 forks source link

Do you support concat as a filter? #282

Closed bstaley closed 7 years ago

bstaley commented 7 years ago

Is it possible to use concat as a filter? If you do and there is some documentation, can you point me to it?

bstaley commented 7 years ago

I have this

context.Contacts.filter(
    'it.FirstName.concat(it.LastName,' ').contains(searchText)',
    {searchText:searchInput.value}
)

and it almost works. If I search with 'John Thomas' it returns no results but if i search with 'JohnThomas' (excluding the single space) it will pull back the record.

Can someone confirm? I'm thinking this is a bug; either that or I'm just using it wrong.

bstaley commented 7 years ago

Changed up my query a little and got it to work with the following

context.Contacts.filter(
    'it.FirstName.concat(" ").concat(it.LastName).contains(searchText)',
    {searchText:searchInput.value}
)

the filtered url becomes this $filter=contains(concat(concat(FirstName,' '),LastName),'John Thomas')