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

Format Decimal to Pounds 2

Status
Not open for further replies.

MochaLatte

Technical User
Jan 11, 2011
39
US
Hello,
I have field or manufacturing weight in decimals, and I need to convert to pounds and ounces.
in this format: 10 lbs and 5 oz.

This is a two step process:
a)convert decimal to pounds
b)format format: "10 lbs. and 5 oz."

Any help will be greatly appreciated!!!
 
MochaLatte,

Can you please provide a bit more detail, and perhaps some examples? (a conversion isn't mentioned, but that doesn't mean you don't have one). I would assume you mean it is decimal format, in pounds. Which would mean that "10 lbs. and 8 oz." would appear as 10.5 in your original field.

Please confirm/advise and I would imagine a solution could be scared up by someone here at TT without too much trouble. [smile]

Cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Thank you for replying Mike!

Weight= 150.79
I need to display as "9 lbs 6.8 oz
 
It is not very elegant, but should work.

numbervar weight :={dec_weight};
numbervar lb;
lb:= weight\16;

totext(lb,0)+" lbs "+totext(((weight/16)-lb)*16,1)+" oz
 
Probably no better, but I would do it like:

Code:
ToText({table.data},'#') + ' lbs and ' + ToText(Round(Remainder({table.data},16),1), '#.#') + 'oz'

Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top