Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
gary b
Dynamic Query
February 16, 2013 6:00 AM
Answer

gary b

Rank: Junior Member

Posts: 73

Join Date: February 2, 2013

Recent Posts

Hi,

I am using dynamic query in my custom announcement portlet. I need to compare journalarticle "displayDate" with current date .
For equal to I can use below syntax and to implement both equal to and less that I need to use Criterion But i don't know the exact syntax for that.

dynamicQuery.add(PropertyFactoryUtil.forName("displayDate").eq(CurrentDate));

I want to know how can we use less than clause using dynamic query.
Kowbathullah Gnaniyar
RE: Dynamic Query
February 16, 2013 6:12 AM
Answer

Kowbathullah Gnaniyar

Rank: Liferay Master

Posts: 603

Join Date: December 19, 2007

Recent Posts

PropertyFactoryUtil.forName("field").lt(5);
gary b
RE: Dynamic Query
February 16, 2013 7:12 AM
Answer

gary b

Rank: Junior Member

Posts: 73

Join Date: February 2, 2013

Recent Posts

Thanks for the reply... :-)

Is there any thing for less that equal to?
Chirag Patadia
RE: Dynamic Query
February 16, 2013 11:49 PM
Answer

Chirag Patadia

Rank: Junior Member

Posts: 29

Join Date: February 2, 2012

Recent Posts

For less than equal to you can use le(object) method.

PropertyFactoryUtil.forName("<<property name>>").le(object);
gary b
RE: Dynamic Query
February 17, 2013 10:40 PM
Answer

gary b

Rank: Junior Member

Posts: 73

Join Date: February 2, 2013

Recent Posts

thanks a lot.. emoticon
actually this is first I am using dynamic query so I am not aware of this.