Zeros Missing when Converting Text to Number

Hi Guys,

    I have a problem when Converting text to a number. "00020" is basically an Account Number. This value is stored in a text field now. But i need to convert this to a number field. When i try to Convert the text values to Number the 000's are getting Cut off. I tried both using formula and lotus script. I need solution for both formula and lotusscript.

In Formula i tried

@TextToNumber(“00020”) which returns 20. Instead i need 00020 as the backend as400 requires 5 digit account numbers.

In Lotusscript i tried

Cint(“00020”) which returns the same 20.

Pls let me know if u have faced this problem before and if u know any solution to this.

Raj

Subject: Zeros Missing when Converting Text to Number

There is no solution to this. A number 20 is a number 20 and will be stored as 20 if it’s a number.

Why would you want to convert it to a number? Maybe there’s a different way of doing things if you explain why you want a number field instead of text.

Dan

Subject: RE: Zeros Missing when Converting Text to Number

Thanks Guys. The reason why i want the text to be stored as number is, to pass a “numeric account number” value to AS400 system. The Backend System(as400-db2) requires this account number field as “5 digit Numeric with no decimal places”. I will talk to the as400 programmer and see if he can tweak his code to read 20 as 00020.

Note: We are using LEI to replicate documents between Notes and Db2(as400).

Anyways, thanks for all yr time.

Thanks,

Raj

Subject: Zeros Missing when Converting Text to Number

If you want leading zeros, you will need to use a text value to represent your number. Something like this should work:

@Right(“00000” + @Text(YourField); 5)

or in script:

Right(“00000” & Cstr(Doc.YourField(0)), 5)

Subject: Zeros Missing when Converting Text to Number

This is pretty standard for numeric data types. Why do you need to store this as a numeric type in Notes? Traditionally, in most languages, account numbers are stored as text, in part due to the need for leading zeros. What datatype is the field in the db used by the AS400 program you are referring to?