13
Views
8
Comments
Solved
Rank: #127
Solution

Hi Spiritfox,

What is your intention for the use of the searchkeyword?  I would expect to allow a search on the name of a given user ?  

In that case, comparing to the id won´ t do at all.  You´ ll have to join to user table twice and do a like on user name. 

Dorine

Rank: #2455

Thanks Dorine,

this way it works

SearchKeyword = ""
or
Trocas.Nota_Devolucao like "%" + SearchKeyword + "%"
or
User_envia.Username like "%" + SearchKeyword + "%"
or
User_recebe.Username like "%" + SearchKeyword + "%"
Rank: #87

Hello SpiritFox,

Hope you're doing well.


The Like operator can only be applied to Texts.

In your case, you're trying to apply this operator to USERID_RECEBE and USERID_ENVIA attributes, which are User Identifiers.

So you'll need to convert those Identifiers to Integers and to Texts after:

SearchKeyword = ""
or
Trocas.Nota_Devolucao like "%" + SearchKeyword + "%"
or
IntegerToText(IdentifierToInteger(Trocas.USERID_RECEBE)) like "%" + SearchKeyword + "%"
or
IntegerToText(IdentifierToInteger(Trocas.USERID_ENVIA)) like "%" + SearchKeyword + "%"


Hope that this helps you!


Kind regards,

Rui Barradas

Rank: #2455

Rui, 

it is not working

Rank: #87

Hello there,

I did some tests in my Personal Area and it seems to be working as expected :)

Can you share your OML?


Kind regards,

Rui Barradas

Rank: #2455
Trocasv1.6.oml

Rank: #87

Thanks for sharing.

I thought you really wanted to search by Id, there are some applications where this applies. In this case, if you want to search for a user and if you can search for its username, Dorine's suggestion is indeed the one you should follow.


Kind regards,

Rui Barradas

Rank: #127
Solution

Hi Spiritfox,

What is your intention for the use of the searchkeyword?  I would expect to allow a search on the name of a given user ?  

In that case, comparing to the id won´ t do at all.  You´ ll have to join to user table twice and do a like on user name. 

Dorine

Rank: #2455

Thanks Dorine,

this way it works

SearchKeyword = ""
or
Trocas.Nota_Devolucao like "%" + SearchKeyword + "%"
or
User_envia.Username like "%" + SearchKeyword + "%"
or
User_recebe.Username like "%" + SearchKeyword + "%"