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

Rounding and Data Type Conflict 1

Status
Not open for further replies.

Scroller52

Technical User
Jan 25, 2008
102
US
I'm running CR XI release 2 on a SQL DB.

I have a text box that is composed of 3 fields.

Shares, Security Type and Company Interest

Field Datatype
Shares number
Security Type string
Company Interest number

My issue is that the data that shares is being pulled is goes to 2 decimal places (i.e. 459.87). Normally I could just use the 'show less decimal places' button for number fields, but CR will recognize my text box as a string. And I can't edit share by itself when it is in the textbox. Another issue is that I only want shares to appear when it does not = 0. So currently I have a formula @shares that reads:
if {SOI.Shares}<>0 then round({SOI.Shares},0)&" "
else
""
This converts shares to a string, but is there a way to not display the decimals at the end? I've looked at the trim functions and they do not seem to work for this problem.

Anyone have a solution for this or a workaround?

Thanks,
Steve
 
if {SOI.Shares}<>0 then
totext(round({SOI.Shares},0),0,"")&" "
else
""

-LB
 
Thanks, LB for the quick reply.

I used your formula and it works, but it takes away the thousands separator. So that 4,534,234 is now 4534234. Any way to get the comma back?
 
if {SOI.Shares}<>0 then
totext(round({SOI.Shares},0),0)&" "
else
""

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top