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!

Using Group name in a title formula without decimals 2

Status
Not open for further replies.

Bennie47250

Programmer
Nov 8, 2001
515
US
I like to have report titles done in a formula, I find it easier to change the report title that way.

Occasionally I will have a group that is a number and I will want to put the group name in the formula. However when I do this the number is displayed as “1.00”. I have tried to remove the decimal point by putting the group name in the ToText(X,Y) where X is the group name and Y is the decimal places and 0 is used for Y. Crystal gives me the error “Too many arguments have been given for this function.

Is there a workaround for this problem?

Thanks
 
you don't need a formula for this, all you need to do is format the group name field. Rick click, format select a number format with no decimals, and whatever else you want it to look like. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
How about grouping on this?

If right({@GroupField},3) = '.00' then mid({@GroupField},1,length({@GroupField})-3)
else {@TextNo}

Naith
 
Wish it was that easy.

When I right mouse click on the group name, number format is not an option. [sadeyes]

 
I just tested this with a number field and it worked no problem. Is the field you are grouping on a number or text?

Test this by bringing up the field explorer and clicking on the far right icon. This should show the data type and length to the right of each field. If it is numberic data I do not know what is wrong. If it is text then convert it to a number in a formula, then group on that formula. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
I think he was saying it's a text field that has numbers in it sometimes - which is why the ToText fell over.

Naith
 
dgillz,

The grouping is done on a number.

In the "title formula" I will usually have some additional text. The formula I’m working with today looks like this:

"Total calls taken for Region " + GroupName ({Table.Field}). This works OK but as I stated earlier, the formula will show decimals after the number.

For region 1 the formula returns : Total calls taken for region 1.00. The decimal point and 00 is what I’m attempting to eliminate.

What Naith has given works, however I do wish there was an easier way.

Should have mentioned earlier, I’m using Crystal 7.0
 
Bennie

One way you could do it is to group on a text version of the field

totext({Table.Field),0,"","")


Now when you use the group name of this group it will have no decimals Jim Broadbent
 
I thought you did try that and it fell over because the group was a string field with a number in it - hence, "Too many arguments" in your first post.
 
Naith - when he was trying it....he was taking the groupname of a field that was numeric and trying to use totext()....I had him convert the field to a string with no decimals instead and group on that (now no further manipulation required. Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top