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!

Display a number preceded by the + sign

Status
Not open for further replies.

Gus01

Programmer
Sep 4, 2009
45
FR
Hi,
Does anybody know how to display a number preceded by the + sign if positive? and that this number does not become a string, not : '+' & {MyNumber}
eg: + 26
Thank you for your help
 
One way you can accomplilsh this which I have used.

Right click the numeric field you are working on
Select Format field
Select the number tab
Click display currency symbol
Select floating
Click Customize
Click the X-2 to the right of Currency Symbol
enter this formula and sve

IF {@Yourfield1} > 0 THEN "+"





_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
Thank you for the idea.
But I already use X-2 of Currency Symbol to display the % symbol behind the number!
So I'd like to be able to display a symbol before (+) and one behind (%) : +12,34% (or -12,34%).

;o)
 
I'm not sure how you could do that with one field and keep it a numeric value. I have seen people do something similar and create a text formula for the % piece and place it left justified next to the number field using the horizontal guides. But its not truly a part of the field when you do that.

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
vertical guides! excuse me

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
I wanted to keep a numeric value field because I use it in a cross-tab, but I see I can put a string in a cross-tab (Summary = Max).
I'll try with a formula returning a string ( '+' & ToText (...) & '%'), if I can find no other solution.
Thank you for your help.
 
You could try using the actual number in the crosstab, but then format the result in the cell using the display string function:

if currentfieldvalue >= 0 then
"+"+totext(currentfieldvalue,2)+"%" else//two decimals
totext(currentfieldvalue,2)+"%"

-LB
 
It works, and it's nicer ... Thank you very much !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top