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!

Fixed length on numeric field 1

Status
Not open for further replies.

Barock21

MIS
Dec 27, 2005
23
US
I have created a formula to get a fixed length character that I can dump to a flat file. It works great for characters however, it doesn't do well with numbers. For example: I have inventory qty of item ABC and it is 2500 eaches. Here's the formula I created:

NumberVar RequiredLength:= 11;
NumberVar CurrentLength:= Length (TOTEXT ({inv_loc.qty_on_hand}));
IF RequiredLength < CurrentLength

THEN TOTEXT({inv_loc.qty_on_hand}) [1 TO RequiredLength]

ELSE ReplicateString ("0",RequiredLength - CurrentLength) + TOTEXT ({inv_loc.qty_on_hand})

Thus, the result now is 0002,500.00 - Is there a way for me to get 00000002500 instead? Any advice?

Thanks.
 
Change the totext:

TOTEXT({inv_loc.qty_on_hand},0,"")

That states no decimals and no thousands separator.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top