Print Page | Close Window

Problem with CXTPReportRecordItemDateTime

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=15627
Printed Date: 29 September 2024 at 1:37pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problem with CXTPReportRecordItemDateTime
Posted By: unknow
Subject: Problem with CXTPReportRecordItemDateTime
Date Posted: 15 November 2009 at 1:03pm
Hi. I have a big issue with CXTPReportRecordItemDateTime class;
 
- I am using this class to display the hour within the ReportControl and sort by time range (60,90,120,>120 minutes)
- The problem occurs when I group the column headers with the field corresponding to this item
- the ReportControls reflect the changes and create groups according to the times comparison routine
- IF there is more than 2 groups, when I click an item, or give the focus to another application, the software goes mad, loops indefinitely and loads hundreds of megabytes in memory
- If there is only 1 group (example items with the same time value), the problem doesn't occur.
 
I think the problem comes from the sorting / priority order used by the ReportControl because if the GetGroupCaptionID function just returns -1, I obtain a group for each different value, but... it works!
 
I've tried everything like using SetGroupPriority, SetSortPriority etc... but nothing seems to work..
 
I'm using the exact same class to group by DATE and it works, so I really don't understand what is wrong !?
 
Here's the class, PLEASE any help is greatly appreciated ! I'm thinking about opening a case, but I guess I'm just forgetting to set something !?
 
class CMessageRecordItemTime : public CXTPReportRecordItemDateTime
{
      DECLARE_SERIAL(CMessageRecordItemTime)
public:
      CMessageRecordItemTime(COleDateTime odtValue = COleDateTime::GetCurrentTime());
      virtual int GetGroupCaptionID(CXTPReportColumn* pColumn);
};

 
CMessageRecordItemTime::CMessageRecordItemTime(COleDateTime odtValue)
 : CXTPReportRecordItemDateTime(odtValue)
{
      SetFormatString("%H:%M:%S");
}
 
int CMessageRecordItemTime::GetGroupCaptionID(CXTPReportColumn* /*pColumn*/)
{
      if (m_odtValue.GetStatus() != COleDateTime::valid)
            return IDS_TXTNONE;

      int nLen = (m_odtValue.GetHour()*60) + m_odtValue.GetMinute();
 
      if (nLen > 120)
            return IDS_GROUP_TIME_XXXMIN;
 
      if (nLen > 90)
            return IDS_GROUP_TIME_90MIN;
 
      return IDS_GROUP_TIME_60MIN;
}
 
IDS Values are:
IDS_GROUP_TIME_60MIN = 2003
IDS_GROUP_TIME_90MIN = 2002
IDS_GROUP_TIME_120MIN = 2001
IDS_GROUP_TIME_XXXMIN = 2000
 



Replies:
Posted By: unknow
Date Posted: 16 November 2009 at 6:53pm
Just spend a few hours trying to find the problem, creating new classes etc... without success, until I found that...
 
What makes the reportcontrol goes mad is to group by such a string (loaded with ID from resources) : "Time: > 90 and < 120 minutes"
 
Why is that ??



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net