Sorting Values And Captions |
Post Reply |
Author | |
zorknemesis
Newbie Joined: 24 May 2009 Status: Offline Points: 4 |
Post Options
Thanks(0)
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?
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.... |
|
zorknemesis
Newbie Joined: 24 May 2009 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
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"???
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.... |
|
malla00
Newbie Joined: 06 March 2008 Location: United Kingdom Status: Offline Points: 6 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |