Dashboard > Atlassian Plugins > ... > Macros > date-sort
  Atlassian Plugins Log In | Sign Up   View a printable version of the current page.  
  date-sort

Added by david , last edited by David Peterson on Feb 27, 2007  (view change)
Labels: 

{date-sort}

Plugin: Reporting Plugin, from version 1.0

This will sort the results by the specified date key value.

Description

By default, empty values will be listed first, then the rest using ascending order.

Usage

{date-sort:prefix:key|order=ascending/descending}

Parameters

Name Required Default Description
[default]/key
The key chain value to sort on.
order
ascending
May be 'ascending' or 'descending'.

Recipes

See Also

I just noticed that doing {date-sort:content:creation date|order=descending} doesn't appear to sort by the creation date, instead items are still sorted by modification date.

I have a news item that which a creation date of 28 October 2006 and a modification of 16 Jan 2007, and no matter what I put in the {date-sort} nothing seems to change.

The whole block is:

{report-block}
{content-reporter:spaces=~markd|type=news|time=7d}
{date-sort:content:creation date|order=descending}
{content-reporter}
{report-body}
.....

Bug?

Hmm. Hard to tell without knowing what the other creation/modification dates are in your news items, but as far as I can tell, the code in the Content Supplier is correct. Direct from the source:

if (CREATOR_KEY.equals(key))
    return getUser(entity.getCreatorName());
else if (CREATION_DATE_KEY.equals(key))
    return entity.getCreationDate();
else if (MODIFIER_KEY.equals(key))
    return getUser(entity.getLastModifierName());
else if (MODIFICATION_DATE_KEY.equals(key))
    return entity.getLastModificationDate();

And I checked that the contstants are checking for the correct values also.

Keep in mind that the 'time=7d' parameter is separate from the sort procedure. It will return all content which has been modified within 7 days. The 'creation date' sort only happens after it has already been selected as fitting within the time period. Not sure if that is what's happening or not here.

I'm having the same problem, in this case with a {user-reporter} that I use thus:

{report-list}
  {user-reporter}
    {date-sort:personal information>creation date|order=descending}
  {user-reporter}
  {report-body}
    {report-info:personal information>creation date}{report-info} 
    ...
  {report-body}
{report-list}

My hope was to get a quick list of the latest added users, so that I could track the adoption of my wiki, but it isn't working.

A further bit of information is that it doesn't sort on last modified date either, whether or not I specify that date in the {date-sort} macro. In fact, just as the original poster noted, nothing that I put in that macro has any effect at all on the sorting order.

I have got the same issue, trying to use creation date in the date-sort macro, but it does not seem to do anything.

Copyright(c) CustomWare Asia Pacific Pty Ltd
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators