Print Page | Close Window

Another Group Sorting bug

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=6468
Printed Date: 09 June 2024 at 12:38pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Another Group Sorting bug
Posted By: vladjv
Subject: Another Group Sorting bug
Date Posted: 20 February 2007 at 9:55am
Hello!

Version:
"Xtreme SuitePro ActiveX v10.4.1"
Codejock.ReportControl.ocx 10.4.1.0


Example project:
"Xtreme SuitePro ActiveX v10.4.1\samples\ReportControl\C#.NET\ReportSample\ReportSample.sln"



I hase made folowing changes:

1)

file:     frmMain.cs"
function:    
private void frmMain_Load(object sender, System.EventArgs e)
//adding to RC only 3 records
               AddRecord(Constants.IMPORTANCE_HIGH, false, false, "postmaster@mail.codejock.com", Subject, Sent, 7, true, 5,
               Received, Created, Subject, EmptyString, Msg, EmptyString, EmptyString, EmptyString,
               EmptyString, EmptyString, Msg);

               Msg = "Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-linefeed sequence also breaks the line.";
               Subject = "Hi Mary Jane";
               AddRecord(Constants.IMPORTANCE_NORMAL, false, false, "Peter Parker", "RE: " + Subject, Sent, 14, false, 4.3,
               Received, Created, Subject, EmptyString, Msg, EmptyString, EmptyString, EmptyString,
               EmptyString, EmptyString, Msg);

               Subject = "";
               Msg = "If you have several conditions to be tested together, and you know that one is more likely to pass or fail than the others, you can use a feature called 'short circuit evaluation' to speed the execution of your script. When JScript evaluates a logical expression, it only evaluates as many sub-expressions as required to get a result.";
               AddRecord(Constants.IMPORTANCE_NORMAL, true, false, "postmaster@mail.codejock.com", "RE:" + Subject, Sent, 24, false, 56,
               Received, Created, Subject, EmptyString, Msg, EmptyString, EmptyString, EmptyString,
               EmptyString, EmptyString, Msg);
2)

file:     frmMain.cs
function:    private void frmMain_Load(object sender, System.EventArgs e)

for(int i=0; i<wndReportControl.Records.Count; i++ )
wndReportControl.Records[ID.COLUMN_FROM].SortPriority=i;

note: RC grouped by COLUMN_FROM.

Based on this:
Originally posted by sserge sserge wrote:

Timo, It sorts groups by GroupPriority if exists, then by GroupCaption if exists, and after that it sorts rows by rows values. Could you please share your piece of code which doesn't work correctly? --WBR,Serge


there are should be 2 groups:

"postmaster@mail.codejock.com" (2 records)
"Peter Parker" (1 record)

But indeed report control shows 3 groups!

"postmaster@mail.codejock.com" (1 record)
"Peter Parker" (1 record)
"postmaster@mail.codejock.com" (1 record)




Replies:
Posted By: sserge
Date Posted: 22 February 2007 at 3:19pm
Below are more details about sorting and grouping.
 
To group rows Report control sorts them firstly.
Then it creates groups for such sorted rows.
Groups are created for rows with identical group keys.
It checks rows one by one from begin to end.
 
To sort rows group keys are used firstly, then sort keys are used.
I mean if you select group by a "From" column and sort by a "Subject" column -- items will be compared by "From" column firstly and in case of identical ones they will be compared by "Subject" column.
 
When comparing by GroupOrder -- GroupPriority is used if specified, otherwise - caption or value.
When comparing by SortOrder -- SortPriority is used if specified, otherwise - caption or value.

See the picture below:


 
And regarding your sample. Records were sorted using SortPriority and grouped according their sorting.
 
GroupPriority and SortPriority are used to separate sorting and groping keys.
 
--
WBR,
Serge



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