Expand my Community achievements bar.

Custom Sorting

Avatar

Level 4

5/6/11

There are some similar posts that seem to be discussing this but I haven't seen one that seems to capture the need that everyone seems to have.

 

When looking at a report, it would be helpful to have the ability to define a custom sort order for that report based on the dimension.

 

Most basic use case is I have a prop where I'm storing "Time of Day" in 30 minute increments. The default sorts right now only allow by metric which isn't useful when I'm trying to examine a time part from 00:00 to 23:30.  

 

Another might be "Day of Week" where the sort order is not alphabetical on the dimension but custom {Sunday, Monday, Tuesday, ...}.

 

In order to make this pretty flexible but not overbearing, perhaps Omniture should have a few basic sorts defined (like those above) and then the ability to define a custom sort order which would allow a user to input some sort() function which compares two strings which would represent dimension values and then returns less than, equal to or greater than (-1, 0, 1).  

 

Users could then define what ever they want when it comes to sorts and could possibly include metrics as well:

 

function sortExample1( row1, row2 ) {

 

    var daysOfWeek = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
    return daysOfWeek.indexOf(row1.dimension) - daysOfWeek.indexOf(row2.dimension);

 

}

 

mike