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 field in GroupTree 1

Status
Not open for further replies.

TomBoardman

Programmer
Aug 25, 2006
26
US
I am using CR ver 11 and I want to format the grouped field in the Group Tree as single decimal and no thousands comma. I am able to format the group field OK in the report. The group tree is defaulting to 2 decimal places and a thousands comma. Any help?

Tom
 
I think you need to create a Formula Field in the format you want and then use it for grouping. I think you could do it with
Code:
ToText({your.number}, 0)
This makes the values alphas and mgiht upset the sort order, you might use something like
Code:
ToText({your.number}, "000")
This would ensure that 2 came before 11, but would truncate any value over 000.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Your suggested solution indicates that the Group Tree field is treated as text type. Is that correct? If so, I'm surprised that CR can't handle numeric types in the group tree, considering the power of the software in other areas.
 
If you group on a numeric, it is handled as a numeric. Change it to String using ToText and it is handled as text.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
It seems to me that if the group field is numeric, the format of the field in the group tree should be the same format as it is in the report section. It seems strange that the group field has to be changed to a text type in the grouptree to achieve the proper format.
 
You could also insert the group on the numeric, and then in the group options, change the group name using a formula:

totext({table.amt},1,"")

-LB
 
Exactly what was needed, Lbass! Thanks alot to you and Madawc for the help!

Tom
 
I tried this formula from lbass...but I get an error that too many arguments were provided ...

right now my formula adds two fields, which I am grouping on... the resulting group looks like this:

42,303.00-5432

but it needs to be

42303-5432

Thanks

Shane
 
The issue is that your group is already text. In your formula where you concatenate the two fields, you should use:

totext({table.number1},0,"")+"-"+totext({table.number2},0,"")

...assuming they are both numbers initially. If one of them isn't a number, then remove the totext(,0,"") on that field.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top