attribute_filter and date handling

Author Message

Nick Woods

Friday 20 February 2004 7:33:02 am

I have a custom class called club_event_item which has a field of type date called event_date (attribute id is 171)

I want to find the next event after the current one based on the date.

This is my code :-

{let next_item=fetch( content, list, hash
( parent_node_id, $node.parent.node_id,
class_filter_type, include,
class_filter_array, array( 'club_event_item' ),
limit, 1,
attribute_filter, array( and, array( 'club_event_item/event_date', '>', $node.object.data_map.event_date) ),
sort_by, array(array('attribute' , true(),171) )
) )
}

I have had it return results by subsituting currentdate() for $node.object.data_map.event_date, i:e :-

( 'club_event_item/event_date', '>', currentdate) ),

so it must be something to do with the way I'm passing in the date from the current record

Any ideas ?

Nick Woods

Friday 20 February 2004 1:13:43 pm

After about 4 hours of fiddling around with this I think I've fixed it. The solution is to use data_int in the where clause :-

attribute_filter, array( and, array( 'club_event_item/event_date', '>',$node.object.data_map.event_date.data_int ) ),

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.