How to use LIKE operator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use LIKE operator

Mith Atul
Can u help me use the LIKE Operator in ofbiz .
Can u give me a demo code on how to use the LIKE operator the  way
from the delegator class.
Thnks in adv .
Reply | Threaded
Open this post in threaded view
|

Re: How to use LIKE operator

Malin Nicolas
Le 06/04/2011 15:58, Mith Atul a écrit :
> Can u help me use the LIKE Operator in ofbiz .
> Can u give me a demo code on how to use the LIKE operator the  way
> from the delegator class.
> Thnks in adv .
in value you use % :
ex :
  * "%a%" search value contains a
  * " %a" serach value end with a
  * "a%" search vallue start with a

Nicolas

--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/

Reply | Threaded
Open this post in threaded view
|

RE: How to use LIKE operator

SkipDever
In reply to this post by Mith Atul
            exprs.add(new EntityExpr(new EntityFunction.UPPER(new
EntityFieldValue("infoString")), EntityOperator.LIKE, new
EntityFunction.UPPER(("%" + email.toUpperCase()) + "%")));
            List c =
EntityUtil.filterByDate(delegator.findByAnd("PartyAndContactMech", exprs,
UtilMisc.toList("infoString")), true);

-----Original Message-----
From: Mith Atul [mailto:[hidden email]]
Sent: Wednesday, April 06, 2011 6:58 AM
To: [hidden email]
Subject: How to use LIKE operator


Can u help me use the LIKE Operator in ofbiz .
Can u give me a demo code on how to use the LIKE operator the  way
from the delegator class.
Thnks in adv .

Reply | Threaded
Open this post in threaded view
|

Re: How to use LIKE operator

Deepak Dixit-2
And for groovy you can also use:

exprBldr = new EntityConditionBuilder();
delegator.findList("InvoiceItemType", exprBldr.LIKE("%" + anyString +"%"), null, null, null, false);


Thanks & Regards
--
Deepak Dixit
HotWax Media Pvt. Ltd.
www.hotwaxmedia.com
Contact :- +91-98267-54548
Skype  :- deepakdixit

On Apr 6, 2011, at 10:28 PM, SkipDever wrote:

>            exprs.add(new EntityExpr(new EntityFunction.UPPER(new
> EntityFieldValue("infoString")), EntityOperator.LIKE, new
> EntityFunction.UPPER(("%" + email.toUpperCase()) + "%")));
>            List c =
> EntityUtil.filterByDate(delegator.findByAnd("PartyAndContactMech", exprs,
> UtilMisc.toList("infoString")), true);
>
> -----Original Message-----
> From: Mith Atul [mailto:[hidden email]]
> Sent: Wednesday, April 06, 2011 6:58 AM
> To: [hidden email]
> Subject: How to use LIKE operator
>
>
> Can u help me use the LIKE Operator in ofbiz .
> Can u give me a demo code on how to use the LIKE operator the  way
> from the delegator class.
> Thnks in adv .
>

Reply | Threaded
Open this post in threaded view
|

Fwd: How to use LIKE operator

Mith Atul
In reply to this post by SkipDever
Thank you it worked.
Can we use like operator  incase of case insensitive query.



---------- Forwarded message ----------
From: SkipDever <[hidden email]>
Date: Wed, Apr 6, 2011 at 10:28 PM
Subject: RE: How to use LIKE operator
To: [hidden email]


           exprs.add(new EntityExpr(new EntityFunction.UPPER(new
EntityFieldValue("infoString")), EntityOperator.LIKE, new
EntityFunction.UPPER(("%" + email.toUpperCase()) + "%")));
           List c =
EntityUtil.filterByDate(delegator.findByAnd("PartyAndContactMech", exprs,
UtilMisc.toList("infoString")), true);

-----Original Message-----
From: Mith Atul [mailto:[hidden email]]
Sent: Wednesday, April 06, 2011 6:58 AM
To: [hidden email]
Subject: How to use LIKE operator


Can u help me use the LIKE Operator in ofbiz .
Can u give me a demo code on how to use the LIKE operator the  way
from the delegator class.
Thnks in adv .
Reply | Threaded
Open this post in threaded view
|

Re: How to use LIKE operator

Rishi Solanki
Atul,
If you want case sensitivity then directly pass the string to the method.
In case you do not want then use EntityFunction.UPPER and pass the string in
upper case.

HTH!

Rishi Solanki
Manager, Enterprise Software Development
HotWax Media Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxmedia.com


On Fri, Apr 8, 2011 at 6:08 PM, Mith Atul <[hidden email]> wrote:

> Thank you it worked.
> Can we use like operator  incase of case insensitive query.
>
>
>
> ---------- Forwarded message ----------
> From: SkipDever <[hidden email]>
> Date: Wed, Apr 6, 2011 at 10:28 PM
> Subject: RE: How to use LIKE operator
> To: [hidden email]
>
>
>            exprs.add(new EntityExpr(new EntityFunction.UPPER(new
> EntityFieldValue("infoString")), EntityOperator.LIKE, new
> EntityFunction.UPPER(("%" + email.toUpperCase()) + "%")));
>            List c =
> EntityUtil.filterByDate(delegator.findByAnd("PartyAndContactMech", exprs,
> UtilMisc.toList("infoString")), true);
>
> -----Original Message-----
> From: Mith Atul [mailto:[hidden email]]
> Sent: Wednesday, April 06, 2011 6:58 AM
> To: [hidden email]
> Subject: How to use LIKE operator
>
>
> Can u help me use the LIKE Operator in ofbiz .
> Can u give me a demo code on how to use the LIKE operator the  way
> from the delegator class.
> Thnks in adv .
>
Reply | Threaded
Open this post in threaded view
|

Re: How to use LIKE operator

Mith Atul
In reply to this post by Mith Atul
Thnk you th eLIKE operator is working  but we have another problem  .

The LIKE operator is sorting by case sensitivity which should not happen in
our case .

How do we avoid case sensitive search in LIKE Operator.

THNK in advance.
Reply | Threaded
Open this post in threaded view
|

Re: How to use LIKE operator

Erwan de FERRIERES
you may start looking to lucene and then you can also add full text search to your queries.
Lucene is present in the content component.
Reply | Threaded
Open this post in threaded view
|

Fwd: How to use LIKE operator

Mith Atul
I am not fluent in lucene. But my req. is to retrieve data by avoiding
case sensitive text  using delegator i.e basic ENTITY.

Pl reply what can we do in context of "EntityExpr"   to avoid case sensitive
text.

---------- Forwarded message ----------
From: Erwan de FERRIERES <[hidden email]>
Date: Sat, Apr 23, 2011 at 8:14 PM
Subject: Re: How to use LIKE operator
To: [hidden email]


you may start looking to lucene and then you can also add full text search
to
your queries.
Lucene is present in the content component.

--
View this message in context:
http://ofbiz.135035.n4.nabble.com/How-to-use-LIKE-operator-tp3430850p3470090.html
Sent from the OFBiz - User mailing list archive at Nabble.com.