Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format number in Group Tree View 1

Status
Not open for further replies.

delu0007

Programmer
Aug 28, 2001
26
US
I have a report based on an Access 2000 database. I have a grouping based on a field of type Long Integer. When the Group Tree View pane is visible, the numbers greater than 1000 have a comma in them (1,000). The field (that is being grouped on) in the report is formatted to not display a comma, but it still displays with one in the group tree. Anyone know how to format this so that the numbers -- no matter how large -- display without any comma delimeters?
 
You would have to go to File-Options-Fields tab-Number button and change the default format to not have the comma. Of course this is a global change and will effect all fields added from then on.

An alternative is to create a formula using ToText to convert to Text formatted as you like (add spaces to pad to keep it soring correctly) and group on the formula. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Thanks for the response.

I tried the first method, and it seemed to work great for changing the number format of the group tree. The only problem is that it is only effective on the development machine. Once the report is distributed through VB and ASP projects, the number is displayed however it is defined on that machine. The setting doesn't seem to be saved with the report, even if the report is re-saved -- it is a setting saved in the registry taking effect over all reports and viewers.

The problem with the second method is that when the report is sorted on that formula field, they are sorted as text. This results in the following sort order 1002,101,10112,103,106,1252,203,73, ... This is not desired. They should be sorted in numeric order.

I tried leaving the original numeric field in the report in addition to the new formula field and sorting on that field, but the grouping sort order takes precedence.
 
I submitted a similar problem to Crystal Reports Support and they recommended using the ToText function in a customized formula for the Group Name field. This did not give me the results I wanted as I still wanted to sort on an integer field. However, I was able to find the correct solution working with a customized formula on the Group name field. I used the CStr function as follows:

CStr ({Tablename.FieldName},"####")
 
Totext has a similar formatting argument to pad the string. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top