Actually the correct query is:

/jcr:root/demo-project[1]//*...@date > xs:dateTime('2009-12-31T00:00:00.000Z') 
and (MetaData/@mgnl:template eq 'myTemplate')]

I had the template search there one too many times.

Jan

On Jul 26, 2010, at 2:39 PM, Jan Haderka wrote:

> Well, of course the query can't work like this. You are looking for property 
> mgnl:template that exists on Metadata subnode and for the date property that 
> exists on the node itself. What you need there is (in xPath):
> 
> /jcr:root/demo-project[1]//*...@mgnl:template = 'stkEvent' and @date > 
> xs:dateTime('2009-12-31T00:00:00.000Z') and (MetaData/@mgnl:template eq 
> 'myTemplate')]
> 
> afaik you can't do the same with the SQL since SQL search doesn't support 
> child axis.
> 
> HTH,
> Jan
> 
> 
> 
> 
> 
> On Jul 26, 2010, at 2:07 PM, [email protected] wrote:
> 
>> select * from nt:base where mgnl:template='stkEvent' and jcr:path like 
>> '/demo-project/%' and date > TIMESTAMP '2009-12-31T00:00:00.000Z' 
>> 
>> Yeah I tried that before sending the initial email. Doesn't work. 
>> 
>> Rich Gange
>> Systems Analyst II, ISD
>> Manatee County Government
>> (941) 748-4501 Ext. 3918 
>> 
>> 
>> From:        Jan Haderka <[email protected]>
>> To:  "Magnolia User-List" <[email protected]>
>> Date:        07/24/2010 03:39 AM
>> Subject:     Re: [magnolia-user]  event query based on a date range
>> Sent by:     <[email protected]>
>> 
>> 
>> 
>> 
>> ... AND date > TIMESTAMP '2009-12-31T00:00:00.000Z' 
>> 
>> Cheers, 
>> Jan 
>> 
>> On Jul 23, 2010, at 2:09 PM, [email protected] wrote: 
>> 
>> I'm trying to write an sql query to get all events within a certain date 
>> range. So far I have a query to get all events: 
>> 
>> select * from nt:base where mgnl:template='stkEvent' and jcr:path like 
>> '/demo-project/%' 
>> 
>> 
>> When I run this query one of the events returned, for example, is the New 
>> Year's Eve event: 
>> 
>> - <sv:node sv:name="new-year-s-eve" xmlns:sv="http://www.jcp.org/jcr/sv/1.0"; 
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> 
>> - <sv:property sv:name="jcr:primaryType" sv:type="Name"> 
>>  <sv:value>mgnl:content</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> 
>>  <sv:value>mix:lockable</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="jcr:uuid" sv:type="String"> 
>>  <sv:value>627e44d9-b582-4798-82e6-69f1759ce896</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="abstract" sv:type="String"> 
>>  <sv:value>This is the abstract of an event-page. It is a brief résumé on 
>> the content of this page. The abstract on the beginning of a page is also 
>> used in teasers and openers that reference this page. Li Europan lingues es 
>> membres del sam familie. Lor separat existentie es un myth.</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="date" sv:type="Date"> 
>>  <sv:value>2009-12-31T14:00:00.000Z</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="dateEnd" sv:type="Date"> 
>>  <sv:value>2010-01-01T05:00:56.000Z</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="eventTitle" sv:type="String"> 
>>  <sv:value>Basels most famous New Year's Eve</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="hideInNav" sv:type="Boolean"> 
>>  <sv:value>false</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="image" sv:type="String"> 
>>  <sv:value>upload</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="imageLocation" sv:type="String"> 
>>  <sv:value>above</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="link" sv:type="String"> 
>>  <sv:value>http://www.magnolia-cms.com</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="linkTitle" sv:type="String"> 
>>  <sv:value>New Year's Eve</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="location" sv:type="String"> 
>>  <sv:value>Marktplatz</sv:value> 
>>  </sv:property> 
>> - <sv:property sv:name="title" sv:type="String"> 
>>  <sv:value>New Year's Eve</sv:value> 
>>  </sv:property> 
>> 
>> The event has a date property: sv:property sv:name="date". How can I 
>> incorporate that into my query. 
>> 
>> Basically, give me all the events that occur after 2009-12-31T00:00:00.000Z 
>> 
>> Thanks 
>> 
>> Rich Gange
>> Systems Analyst II, ISD
>> Manatee County Government
>> (941) 748-4501 Ext. 3918 
>> 
>> 
>> 
>> 
>> ----------------------------------------------------------------
>> For list details see
>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>> To unsubscribe, E-mail to: <[email protected]>
>> ---------------------------------------------------------------- 
>> 
> 
> 
> 
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to