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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

numerical format of field in tree 1

Status
Not open for further replies.

hsandwick

Programmer
Sep 10, 2001
286
US
Hello,

How do I change the numerical format of a group field in the tree structure from "x,xxx.xx" to "xxxx"?

Thanks in advance.

-H
 
In CR 8.5 when using a value I don't get a thousands delimiter nor a decimal place.

Aside from posting basic information, such as your Crystal version and database, post the data type for this field (right click it and select browse to learn this).

You might need to convert it and use the converted value as your group formula. If it's a currency type, you may have to work around a Crystal bug, but try:

val(totext({table.field}))

If that returns zero, try:

replace(replace(replace(totext({table.field}),"$",""),",",""),".00","")

-k
 
Ooops, that should have been:

val(replace(replace(replace(totext({table.field}),"$",""),",",""),".00",""))

-k
 
Thanks, synapsevampire, for sending me down the right path. It's a number type, and based on your sample, the following worked:

ToText(replace(replace(totext({ORDER_1.ItemNo}),",",""),".00",""));

:)

-H
 
The problem with using your method is that it won't sort properly as a text, wrap it all in a VAL() and you should be fine.

-k
 
Now, here's somthing odd. When I wrap it w/VAL, it returns to the decimal format! It looks ok w/out val for now, 1271 comes before 1583 and so on. Perhaps it'll not give any headaches later on!
-H
 
12000 will come before 1500.

I think that I figured it out, it follows the formatting selected in:

Fiel->Options->Fields->Number->Number

I always turn off the decimals and thousands seperator as the default.

-k
 
Go to "change group" under customer header select formula and add

cstr({ORDER_1.ItemNo}),"#")

That should do it.

Lisa
 
Oh... and go back to just grouping on the numeric field.

Lisa
 
Hi, Lisa, thanks but it didn't like # -- "remaining text doesn't appear to be part of the formula" error msg. oh well, worth a try. maybe it's cause i'm using crystal reports 9 and it's buggy

Synapsevampire, yes, i think the order must be working on its own. lucky for me.

-H
 
Ack.. extra ) hate when i make copy paste mistakes:

cstr({ORDER_1.ItemNo},"#")
 
H: The order isn't working on it's own, it's just that you have the same precision right now.

If you convert it to a string, you have potential for not having the proper sort.

Why don't you just go change the default as I suggested? I can turn the decimals and comma off and on that way...

-k
 
Synapsevampire's right, the default settings determine the format used for the group name fields.

You will also find you need to remove the group name field and re-insert it after changing the default settings.


Steve Phillips, Crystal Trainer/Consultant
 
OK, excellent. Your suggestions are in place, and now I have the issue resolved AND it's dependable. Thank you all!

Helen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top