Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Sort the column to numeric values​​?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Sort the column to numeric values​​?

 Post Reply Post Reply
Author
Message
g.novi View Drop Down
Groupie
Groupie


Joined: 27 October 2009
Location: Italy
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote g.novi Quote  Post ReplyReply Direct Link To This Post Topic: Sort the column to numeric values​​?
    Posted: 13 July 2011 at 7:27am
How to sort the column to numeric values​​?
A report column contains numeric values ​​but the sort does not work.

Now sort in this way:
   10,00
 100,00
   12,00
   13,00   
   20,00
     3,00
 
I would like this result:
     3,00
   10,00
   12,00
   13,00   
   20,00
 100,00

Thank's to all
   
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: 13 July 2011 at 8:13am
Hi,
 
Did add numeric values as text or as Integer, Long, Double? RC supports type sorting. If you added it as text it sorts like MS explorer does,   1,10,11,2,3,4,5 etc, etc
 
If you are able to convert text to type you need it will work, if you can't just set .SortPriority when adding items to RC  
 
 
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
g.novi View Drop Down
Groupie
Groupie


Joined: 27 October 2009
Location: Italy
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote g.novi Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2011 at 10:21am
Originally posted by Aaron Aaron wrote:

Hi,
Did add numeric values as text or as Integer, Long, Double? RC supports type sorting. If you added it as text it sorts like MS explorer does,   1,10,11,2,3,4,5 etc, etc
 
If you are able to convert text to type you need it will work, if you can't just set .SortPriority when adding items to RC  

Hi,
maybe because I insert formatted numbers? (Ex: 12 in 12,00).
How do I get formatted numbers and correct sort?
Thank You.

Back to Top
g.novi View Drop Down
Groupie
Groupie


Joined: 27 October 2009
Location: Italy
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote g.novi Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2011 at 10:52am
Originally posted by Aaron Aaron wrote:

...
If you are able to convert text to type you need it will work, if you can't just set .SortPriority when adding items to RC  

If I convert text into Double type it works, but the number will not be formatted!
How can I do!?

Thank's
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: 13 July 2011 at 4:41pm

Originally posted by g.novi g.novi wrote:

[...]
If I convert text into Double type it works, but the number will not be formatted!
How can I do!?
[...]

OK, you solved that part...

You can't use .Format property because it will be "converted" to a string and it doesn't sort properly anymore. Best way is to use custom format in BeforeDrawRow event something like this:

in FormLoad (or wherever you initialize RC) set:
wndReportControl.SetCustomDraw xtpCustomBeforeDrawRow

 
Private Sub wndReportControl_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
 
    Row.Record.Item(0).Caption = Format(Row.Record.Item(0).Value, "##0.#0")

End Sub

Hope this helps Wink
 
 
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
g.novi View Drop Down
Groupie
Groupie


Joined: 27 October 2009
Location: Italy
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote g.novi Quote  Post ReplyReply Direct Link To This Post Posted: 14 July 2011 at 9:52am
Originally posted by Aaron Aaron wrote:

...

Private Sub wndReportControl_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)

    Row.Record.Item(0).Caption = Format(Row.Record.Item(0).Value, "##0.#0")

End Sub


Very well !!!

Thank you

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.203 seconds.