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
I don't know why the grouping would not work as expected. Simply setting for column's format to "h tt" and setting GroupByMode to Text works fine in the sample that I attached previously. Is it possible for you to send me a sample of a grid with a DateTime column and GroupByMode of Text where the grouping doesn't work as expected?
Sincerely,
CharlieSenior Developer Support EngineerMCTS
I already had the fileds as date but formmated to display the text I wanted. Then I set group by to text and it wasnt working properly. Not sure why.
Hello John.
I have attached a modified version of the sample I attached previously. The only difference is that it doesn't use a custom GroupByEvaluator. I set the format of the LastOrderDate column to "h tt" and the GroupByMode is set to Text.
When you group by the LastOrderDate column it makes just one GroupByRow because the text displayed in each row is "3 PM". It also worked and created just one GroupByRow if the GroupByMode is set to First4Characters and OutLookDate. With OutlookDate it created one row with a text value of "Earlier this month". If you change the GroupByMode to something else, such as Date, or if you change the format string then you will get different results.
Take a look at this sample and let me know.
Charlie
Senior Developer Support Engineer
MCTS
I will wait for the fixes in a new release. Until then, I have fixed it by converting to string. The grid is only a view and is not updateable so it isnt too much of an issue.
Thanks
After speaking further with our developers I am going to log this as a development issue. They felt that with the GroupByMode set to a DateTime column should group the way you are looking for. Changing the field in your data base to a string is not the best solution. It's better to leave that as a true DateTime field because when those fields are brought into .NET from a data reader, they will be created as a true .NET DateTime type.
This means that sorting and filtering will work properly and updates will be handled a lot easier. With a column of type string, you can enter anything you want and a lot more validation will be required to keep everything in the same format. With a true DateTome field, this is much easier. If you need help getting the IGroupByEvaluator interface to work properly I can help you out. I would much rather see you implement that as a temporary solution while the grid is fixed than to change the data type of a field in your data base to type string. The IGroupByEvaluator interface would be a temporary solution only until the next service release is made public.
CharlieSenior Developer Support Engineer