[Hippo-cms7-user] [Hippo Hilter on HSTQuery] - date problem

Jeroen Reijn j.reijn at onehippo.com
Wed Apr 20 08:34:01 CEST 2011


Hi,

you do not need to put the quotes and xs:dateTime( in yourself.

I'm doing it like:

Filter dateFromFilter = query.createFilter();
dateFromFilter.addGreaterOrEqualThan(DocumentTypes.Document.FRONTEND_DATE,
beginDate.toDate());
mainFilter.addAndFilter(dateFromFilter);

the xs:dateTime is added by the HST through inspection of the input type. If
you provide a type of date it will add the xs:dateTime automatically.

Gr,

Jeroen

On Wed, Apr 20, 2011 at 2:04 AM, senofonte <senofonte123 at gmail.com> wrote:

> Hi,
>
> i had a problem using the HSTQuery with a lot of filters wich one is a
> Date.
> For Each AND Filter I Use this kind of code:
>
>  <code>
>  Filter titleFilter = hstQuery.createFilter();
>  titleFilter.addContains("@mynamespace:field", "fieldvaluetocheck");
>  filter.addAndFilter(titleFilter);
>  </code>
>
> It works for all the AND Filters, but when I add a Filters for a Date (it's
> an Advanced Search Form)
> using and expression like:
>
>  <code>
>  Filter f = new FilterImpl();
>  f.addLessOrEqualThan("@namespace:dateField", "xs:dateTime('" +
> xmlCal.toXMLFormat() + "')");
>  </code>
>
> (where xmlCal it's a XmlGregorianCalendar)
>
> the method addLessOrEqualThan (and also the others method) don't evaluate
> the xs:dateTime
> and use that expression like a String, so the HstQuery produced it's
> something like ... <= 'xs:dateTime(...)'.
> How can I disabile the "'"?
>
> I Also tried to add a Filter with addJCRExpression(), but the normal
> filters
> and a JCRExpression Filter cant' find nothing.
>
> Thanks,
> S
>
> --
> View this message in context:
> http://hippo.2275632.n2.nabble.com/Hippo-Hilter-on-HSTQuery-date-problem-tp6289135p6289135.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onehippo.org/pipermail/hippo-cms7-user/attachments/20110420/31336362/attachment.htm>


More information about the Hippo-cms7-user mailing list