Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Sorting Values And Captions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Sorting Values And Captions

 Post Reply Post Reply
Author
Message
zorknemesis View Drop Down
Newbie
Newbie
Avatar

Joined: 24 May 2009
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote zorknemesis Quote  Post ReplyReply Direct Link To This Post Topic: Sorting Values And Captions
    Posted: 24 May 2009 at 2:45am
Hello!
 
We need to sort a column which contains contact-numbers.
The item/field contains constraints, which data-key corresponds with the item.value. The caption-string from the constraint displays the surname and given name from the underlying item.value.
The ReportControl displays the name of the contact correctly. But when we re-sort the column by clicking the column-caption, the column is sorted by the underlying item.value and not by the needed caption from the constraint!
 
We urgently need a workaround to this behavior! Can anyone help us?
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2009 at 10:08am
Hi,
 
You can use SortPriority property for this kind of sorting. Assign (integer) values to SortPriority and you can sort captions properly
If I understand correct you want to show the surname (Item.Caption) and Lastname would be Item.Value, correct? Now adding items like this:
 
Set rec = wndReportControl.Records.Add()
        Set recItem = rec.AddItem("B...")
            recItem.Caption = "Aaron"
            recItem.SortPriority = AscB(recItem.Caption)
   
    Set rec = wndReportControl.Records.Add()
        Set recItem = rec.AddItem("A...")
            recItem.Caption = "SuperMario"
            recItem.SortPriority = AscB(recItem.Caption)
   
    Set rec = wndReportControl.Records.Add()
        Set recItem = rec.AddItem("N...")
            recItem.Caption = "Zork"
            recItem.SortPriority = AscB(recItem.Caption)
   
 
doesn't sort items properly (comment code with recItem.SortPriority) :
Asc:
1 > Supermario (Item.Value = A...)
2 > Aaron          (Item.Value = B...)
3 > Zork            (Item.Value = N...)
 
Desc:
1 > Zork            (Item.Value = N...)
2 > Aaron          (Item.Value = B...)
3 > Supermario (Item.Value = A...)
 
proper sort on Item.Value though
 
Now run again with code recItem.SortPriority
 
Note: If you change Item.Caption you have to change Item.SortPriority as well
 
or place code in BeforeDrawRow event: Item.SortPriority = AscB(Item.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....
Back to Top
zorknemesis View Drop Down
Newbie
Newbie
Avatar

Joined: 24 May 2009
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote zorknemesis Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2009 at 12:18pm
Hi Aaron,
 
thanx for the answer.
I already tried the workaround with sortpriority, and I also tried to use the AscB-Function.
But if you work with AscB, only the first letter in the caption is converted to a sortable number-value!
The result is a not properly sorted column if there are captions with the same first letter in it.
 
AND:
If you would like to set "sortpriority" programmatically for the needed recItems AFTER you have already filled the recportcontrol, and you walk through the records for setting the "sortpriority"
like this:
 
for each record in wndReportControl.records
      Set recItem = record.item(x)     
      recItem.SortPriority = AscB(recItem.Caption)
 
next record
 
then the SortPriority from those recItems which are "out of sight" (at the end of the list) are incorretly set by the recItem.Value.
btw: the recItems are having constraints!
 
Aren't there properties to set the column-sorting to the "value" OR to the "caption"???
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2009 at 4:09pm
Hi,
 
Maybe you have to approach this another way...
 
Can you upload test project?
 
 
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....
Back to Top
malla00 View Drop Down
Newbie
Newbie
Avatar

Joined: 06 March 2008
Location: United Kingdom
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote malla00 Quote  Post ReplyReply Direct Link To This Post Posted: 30 July 2009 at 6:05am
Originally posted by Aaron Aaron wrote:

Hi,
 
Maybe you have to approach this another way...
 
Can you upload test project?
 
 
 
Is there any solution to this?  I am experiencing the same problem.  I seem unable to fully sort alphabetically on a constraint column.
 
Product
------------------------
Xtreme SuitePro (ActiveX)version 12.0.0

Platform:
------------------------
Windows XP (32bit) - SP 3

Language:
------------------------
Visual Basic 6.0
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.