|
-
May 15th, 2010, 12:46 PM
#1
Thread Starter
Lively Member
[RESOLVED] How to use rowfilter to filter year, or month+year
Hello All,
It seems that for every answer I find another question, if I'm lucky only 1, is raised. Also this one seemed so simple, but has already kept me busy for over 2 days with only finding dead ends.
I'm trying to filter a dataview for e.g dates with a year larger then 2005, or e.g items with a month+year larger then Oct 2005. The compared to value comes from a datatimepicker which depending upon users input has a custom format of either full date, month+year or year as its textproperty.
I know that rowfilter is very limited in its options, and that's where my problem lies.
The dates in my dataview are real dates, M/dd/yyyy, so no conversion needed. The date columns type is also DateTime as such. The problem though is that I'm not able to separate the year, or month+year from the date columns value to compare against the datetimpickers value.
On several places on the internet I found references to using the format function.
Code:
.rowfilter = "FORMAT(columnname, 'yyyy') > '2005'"
But unless I'm doing something wrong, the format function is not supported under rowfilter according MSDN.
On this forum I found a comment stating that it's simply done using > or >=, etc. But that works only with full dates, not when only stating a year or month+year. as such when doing something like that on August 5th, you'd get all results for August 6th and onwards.
I also found references in combination with String.Format. But again the only formatting done is for the values compared to, not for the comparing value from the date column.
-How do you filter e.g items with a year larger then 2005, if at all possible?
-How do you filter e.g items with a month + year larger then Oct 2005, if at all possible?
Thanks for any input on my question.
Best regards,
Leon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|