How to remove comma from crystal report string and

2019-04-21 14:24发布

How can I remove the comma (,) from crystal report fields?

I have a field name "year" which is having a value of 2012, but when I show that value in crystal report it includes a comma, becoming 2,012.

How can I show only 2012?

5条回答
forever°为你锁心
2楼-- · 2019-04-21 15:04

try this for formula

ToText( ToNumber({variable1}), "#" )
查看更多
小情绪 Triste *
3楼-- · 2019-04-21 15:06

Try below code,

Replace (ToText ({Tablename.Year_Field}, 0),"," ,"" )
查看更多
一夜七次
4楼-- · 2019-04-21 15:08

I'm just guessing but I believe you have embedded your field name into another object such as a text field.

If this is the case, double click your text box in the design view, then select your text field you are having issues with. Right click and select "Text Formatting", under the Font tab click the 'Format Formula Editor' button (the one with the X-2) to the right of the Font drop down menu. Now all you have to do is close the formula editor, then cancel the Text Format window. NOW when you right click on your year field again you will have a new option to Format the field which was previously grayed out.

Alternatively, you can remove your year field from any other object it is nested in. This will give you access to all formatting options.

查看更多
姐就是有狂的资本
5楼-- · 2019-04-21 15:14

In the crystal report designer view:

Right mouse click on that field, and select Format object. Select Custom Style in the Style list, and click Customize. Untick Thousands Separator, and any other unwanted formatting.

Failing that, you could try selecting the field and deleting the "," value from the property ThousandSeperator in your properties window.

enter image description here

查看更多
欢心
6楼-- · 2019-04-21 15:23

NumberVar cRed; ToText (cRed,"#")

OR

ToText({some numeric field value},"#")

The "#" has to be enclosed in parenthesis, single or double.

查看更多
登录 后发表回答