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!

format decimal number

Status
Not open for further replies.

eissa2000

IS-IT--Management
Apr 18, 2003
4
EG
Dear sir
How can i format decimal number to be displayed in datawindow with replacing decimal dot separatore with space as:
145.65 displayed as 145 650
67.652 675 652
0.53 530 (no decimal number}
I did this using computed field , but i think there is another way.

many thanks

 
Try 'playing' with the format of the column in the datawindow painter. I've done things like appended letter status to dates, appended asterisks to numbers, and such. Maybe something like:

left(string(number),pos(string(number),'.' - 1)) + ' ' + right(string(number),len(string(number)) - pos(string(number),'.'))

since the resulting column is a string and not a number there may be other formatting issues.
 
thanks mplanet
I wrote that script in format propert of the field, but find some valid /invalid values e.g.
23.45 --> 23 45
0.14 --> 14
0.76 --> 1 76


when number >= 0.5 , it is 1 + decimal
also i want to align numbers in that away
145.65 145 650
675.65 675 650
0.53 530
i think as you said "since the resulting column is a string and not a number there may be other formatting issues"

can we find these issues.
many thanks


 
left(string(number * 1000
),pos(string(number * 1000
),'.' - 1)) + ' ' + right(string(number * 1000
),len(string(number * 1000
)) - pos(string(number * 1000
),'.'))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top