Forums / Developer / I can't sort by date

I can't sort by date

Author Message

Adolfo Barragán

Tuesday 07 October 2003 1:12:12 am

I'm trying fetch a list of classes and I need this list is sort by date (an attribute).

I put this code:

{let mylist=fetch('content',' list',
hash(parent_node_id, $node.node_id,
class_filter_type, include,
class_filter_array, array(18),
sort_by, array(array('attribute',false(),179))
))}

179 is the attribute Id for my ezdate field, but my list is unordered.

What's is wrong?

Regards
Adolfo Barragan

David Syers

Monday 13 October 2003 10:20:10 am

Hi Adolfo

Try:

{let mylist=fetch('content',' list',
hash(parent_node_id, $node.node_id,
class_filter_type, include,
class_filter_array, array(18),
sort_by, array('attribute',array(179,false()))
))}

or:

{let mylist=fetch('content',' list',
hash(parent_node_id, $node.node_id,
class_filter_type, include,
class_filter_array, array(18),
sort_by, array('class_identifier',array('your_ezdate_field_identifier',false()))
))}

Adolfo Barragán

Monday 13 October 2003 11:58:56 pm

I try both pieces of code, but none send me results.

Tony Wood

Friday 31 October 2003 8:55:26 am

I get this as well, I am on 3.2-3. Other sorted work fine, its just sort by a date doesn't work for me.

Tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Alexandre Cunha

Wednesday 05 November 2003 10:33:08 am

How can i reverse order by date or other field ?

http://AlexandreCunha.com

Joris Lint

Thursday 06 November 2003 6:59:25 am

For reverse order, you can take a look at:
http://ezwiki.blanko.info/index.php/3XHT_FetchFunction

Tore Skobba

Thursday 18 December 2003 7:03:49 am

Hmm did anyone manage to solve this by the use of sorting at fetch? I did not and I am seeking for an solution. Currently I am using the "date" (datefield) as the name pattern and then sorting all objects on the name pattern.

UPDATE: I managed it now (sometimes I am bit to fast on the post button). Heres how I did it:

{let cal_list=fetch('content',list,
hash(parent_node_id, $node.node_id,
class_filter_type, include,class_filter_array, array(20),
sort_by,array('attribute',true(),175)))}

Where 175 is the id for the attribute which content is to be sorted on.

cheers
Tore

Adolfo Barragán

Friday 19 December 2003 12:22:49 am

> Currently I am using the "date" (datefield) as the
> name pattern and then sorting all objects on the
> name pattern.

But this is not a solution. My date field is not required, so I can use it for name.

Regards
Adolfo

Mike Borozdin

Sunday 21 December 2003 6:40:07 am

Hmm, eZ Publish keeps the date of posting an article somehow, but I don't know how. Do you know?

I think, if we knew how we could use its date field instead of creating our own field.