Print Page | Close Window

Grouping/Sorting

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=14070
Printed Date: 14 November 2024 at 11:30pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Grouping/Sorting
Posted By: keepITcool
Subject: Grouping/Sorting
Date Posted: 18 April 2009 at 5:58pm
Could there be a Sticky or Tutorial re grouping & sorting?
 
If I missed in the helpfile than please tell me. I spent way to much time before i understood the finer details. Is there a doc/tutorial/sticky that explains the details and intracacies of Value/Format/Caption/SortPriority/GroupCaption?
 
I have a column with Excel cell addresses, e.g. L8 and AX10.  Depending on variable I want to sort by column or row.
Sorting on the raw address gives unacceptable results: At least the caption must be left padded with spaces else AXnnn will sort before Lnnn
 
After my "discovery phase"  I found it's really quite simple:
I set the Value of the Item as a Double: RowNumber+ColNumber/100000# (or swapped depending on my variable)
I set the Caption of the Item (as string) to the cell's Address
I set the GroupCaption as "Column:" & padding & ColLetter (or "Row:" & padding & RowNumber depending on variable)
 
I need the padding for the group as the only sort property is the caption.
 
REQUEST:
For the ReportGroupRow class:
Add a GroupValue Property. (Probably with GroupFormat?)
Remove the GroupRow boolean property: Can this be false for a grouprow?, or is it just the Interface/Implement?
 
For sorting : it would be nice to have an "intuitivesort" flag for strings where characters are followed by numbers.
(or is this implemented for item sorting but not for group sorting?)
 
 
It's been a struggle. Did I miss the obvious explanation in the help file or on the website? I'm normally the first to scream RTFM.
 
 
 
 


-------------
Xtreme :SuitePro (ActiveX) version 13.1.0
Language: VB 6.0
Platform: WinXP/Win7(32+64bit)



Replies:
Posted By: Aaron
Date Posted: 20 April 2009 at 2:26pm
Hi,
 
REQUEST:
For the ReportGroupRow class:
Add a GroupValue Property. (Probably with GroupFormat?)
Remove the GroupRow boolean property: Can this be false for a grouprow?, or is it just the Interface/Implement?
 
Answer: What would GroupValue actually do for you?
 
For sorting : it would be nice to have an "intuitivesort" flag for strings where characters are followed by numbers.
(or is this implemented for item sorting but not for group sorting?)
 
Answer: If you would get the numbers from the string you can use these numbers to set SortPriority
               Setting SortPriority will sort on the value you assigned, and not on Caption
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: keepITcool
Date Posted: 21 April 2009 at 4:19am
 
GroupValue...  it would follow the construct of the RowItem Value,Mask,Caption. Suppose I have 2 rowitems
Value: 9,00026 /  Caption: Z9 / Groupcaption: "000009"
Value: 123456,00256 / Caption: IV123456 / GroupCaption: "123456"
I must set the groupcaptions and rework them in the beforedraw event. Rather a waste of resources  I sometimes need 300.000+ records, so I have to measure performance and memory. 6 char string=16bytes. 1 long=4 bytes....
 
SortPriority is an Integer. Can't use it as it will cause overflows.
 
 
 


-------------
Xtreme :SuitePro (ActiveX) version 13.1.0
Language: VB 6.0
Platform: WinXP/Win7(32+64bit)


Posted By: Aaron
Date Posted: 21 April 2009 at 11:28am
Hi,
 
I just did test with 3 million records and I'm able to assign SortPriority value with same number as Record.Index and it does still sort OK.
 
 
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: keepITcool
Date Posted: 21 April 2009 at 2:46pm

Documentation says it's an integer, but Typelib shows it's a long. Thanks.

Doesn't solve my Group problem though, does it?


-------------
Xtreme :SuitePro (ActiveX) version 13.1.0
Language: VB 6.0
Platform: WinXP/Win7(32+64bit)


Posted By: Aaron
Date Posted: 23 April 2009 at 12:54am
Hi,
 
I don't know if it will solve your problem...
I'm not sure what you really want... I created small demo using sort & groupPriority and you will see difference. 
 
https://forum.codejock.com/uploads/20090423_005543_TestSorting.zip - uploads/20090423_005543_TestSorting.zip
 
You could change code in sample so I can see what you are trying to accomplish
 
 
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: keepITcool
Date Posted: 24 April 2009 at 7:11am

Aaron

Thanks for the nice example!
 
I had failed to spot the Grouppriority, and I still fail to see the SetMask method I have in SuiteControls and PropertyGrid.
GroupPriority doesnot solve my problem, but it helps. Suppose I want the items grouped in 8 groups of 125 items each. Modify your example to 1000 records, and set the grouppriority to (i - 1) mod 125 + 1
 
Group priority ONLY influences the SORTING of the groups, NOT the grouping itself, and not the Sorting of the items.
 
My reallife example is more complicated but solved. Thanks for the explanation.
 
 
 
 


-------------
Xtreme :SuitePro (ActiveX) version 13.1.0
Language: VB 6.0
Platform: WinXP/Win7(32+64bit)


Posted By: Aaron
Date Posted: 24 April 2009 at 3:40pm
Hi,
 
If you want to group on items with (for example) value 10.00 to 10.99 you could set GroupCaption for these items: "All values between 10 and 11" and RC will group these items because they have same GroupCaption.
 
 
Just replace existing code with BOLD code
 
For i = 1 To 1000
       
        Set rec = wndReportControl.Records.Add()
        Set recItem = rec.AddItem(i)
              recItem.GroupPriority = i Mod 125 
              recItem.SortPriority = i
              recItem.GroupCaption = i Mod 125
        
      ...................................
Next i
 
 
Now sorting will be on grouped items, and sort ascending & descending on childs of that grouprow works with values as should
Well sometimes it will come in handy when using these properties, especially with numbers. I remember the MS Listview where we had to add code to sort on numbers and RC has build-in properties to handle these kind of issues.
 
  
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



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