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!

Converting a number to text, leading zeroes and no decimal 1

Status
Not open for further replies.

scootswiss

Technical User
Mar 1, 2001
11
US
ToText {FMSH_REQUISITION_DETAIL.COST_EA}, "000000.00000",5)

Above is my formula to convert this Oracle cost field to text. It works, but our mainframe programmers need this field formatted without the decimal. How does this formula need to be written? The Oracle field is a number(9,4). At minimum the field being uploaded needs to be 6 whole characters with leading zeroes for less than 100,000 and 5 characters for decimal precision. So, for example, $12.3456 should be passed as 00001234560. Thanks in advance for any help.
 
Since all you need to do is get rid of the decimal from the string, you could replace the decimal with an empty string.
Replace (ToText{FMSH_REQUISITION_DETAIL.COST_EA}, "000000.00000",5),".","") Malcolm
 
This did work except putting "" returned no data in this column. Changing it to " " put a space between the whole numbers and the decimal. This also worked doing something such as "b". Any suggestion on how to correct the "" situation?
 
Hmm, works OK in V8.5 - what version are you using?
This following alternative method uses a variable for readability, and takes the first half of the string and concatenates it with the second half.
Local StringVar TempString ;
TempString := ToText({FMSH_REQUISITION_DETAIL.COST_EA}, "000000.00000",5);
TempString [1 to 6] + TempString[8 to 12] ;
This assumes that your string is always 12 characters long, which based on your conversion, is probably reasonable. Malcolm
 
Malcolm, tried your suggestion. Worked very well. Thank you much for your assistance.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top