Should Filters.FilterPropertySort be type aware?


..  because currently (CMS6 R2) I dont think it is. I have been using this filter to sort a PageDataCollection by StartPublish Descending (to get most recent pages at the start of the list) and the ordering is completly wrong. Further more I noticed that if you call the Filter method a couple of times, the ordering is changed each time! (Surely once something has been sorted, re-sorting it should not change anything).

I've solved the problem by creating my over version of the filter which works with DateTime (or PropertyDate) property types.

It would appear that this filter only works with string values but no mention of that is said in the SDK (

So my question is - Is this by design? I'm supprised to not find any mention of this in the forums or blogs? are people generally not using this filter for sorting (favouring custom filters or linq?)




May 04, 2012 11:23

It should work to sort by StartPublish. I guess you know you have to use "PageStartPublish"?

new FilterPropertySort("PageStartPublish", FilterSortDirection.Descending).Filter(pagesToSort);

Personally I use LINQ when sorting nowadays, especially when using PageTypeBuilder.

May 04, 2012 14:53

Thanks Erik - I'll give it another try using "PageStartPublish" as I think I was just using "StartPublish" - I am using PTB but this code is part of search behind a webserivce so im trying to keep it as effiecnt as possible for big PageDataCollections.

May 04, 2012 15:57

Erik - that was it! Very annoying - seems if you pass a propery name that doesnt exist, some other form of sorting occurs - would a null reference exception or similar was thrown.

Any how, I can confirm it works correctly with String, Date and Int fields (so I guess it should work with any other type that is comparable)


May 08, 2012 22:34
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.