Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
890
GroupByMode.Text not working properly for some columns
posted

Hi. Let me explain.

My database has 7 date fields. They are all the same date, I just renamed them so I can show them separetly in a Grid.

LogDate, LogYear, LogMonth, LogDay, LogDayOfWeek, LogHour, LogMinute

I format each of those columns to show only the part of the DateTime that I want to show for that column. I get the correct info in the grid. I use the GroupByMode.Text so when it is grouped, it does it properly.  All of them seem to work fine except for the time formatted fields.

Hour and Minute show correctly (4 PM and 24 respectively) then i group them in my grid and they looked fine, but on closer inspection, there were two 4 PM hours showing, each with their own date. So if I did another log at 4 PM on a different day, it would have three 4 PM in my groups. The same thing happens by minute. For some reason it looks like it is grouping by date before it does the text. 

I test and the text of the cells are correct.  The other date parts seems to be working fine.

Please help! IG version 20102.2064

Parents
  • 2197
    posted

    Hello John.

    I have attached a sample here where I implemented the IGroupByEvaluator interface. The grid is bound to a data table containing a column of type DateTime. There are 20 rows and I gave all of them the same time (3 PM), but 10 of them have a date of 10/1/2010 and the other 10 have a date of 10/2/2010.

    When you group the grid by the LastOrderDate column you get just one group by row because it is performing the comparison on the hour instead of the whole date. The GetGroupByValue method returns just the hour portion of the date and the DoesGroupContainRow method looks at that hour that is passed in and compares it to the hour in cells date.

    Please let me know if you have any questions.

    Sincerely,

    Charlie

    Senior Developer Support Engineer

    MCTS

    CustomGroupByEvaluator.zip
Reply Children