Making a 2 digit integer in lotusscript

Hi

How can I make a 1 digit integer ( e.g. 1, 4, 5) a 2 digit integer ( e.g. 01, 04, 05) in LotusScript? I need this for fields that have a name with at the end a number so i can access them in a loop ( e.g. for loop).

Regards

Subject: Making a 2 digit integer in lotusscript

Harry, sounds line you want this to be a string value for the loop. How about something like this:

for j% = 1 to 15

I$ = right$(“0” & cstr(j%),2)

next

I$ will be “01”, then “02”, etc. When j% = 10, then I$ will be “10”

Subject: Making a 2 digit integer in lotusscript

It’s fairly easy… Assuming your digit is stored in the integer variable named MyDigit:

in formula:

@Right (“0000000” + @Text (MyDigit) ; 2)

in lotusscript:

Dim result as string

result = Right (“000000” & Cstr (MyDigit) , 2)

HTH

Nicolas Abesdris

Quintessence e-solutions Inc.

Subject: Take a look at the Len function.

If len(fieldname) = 1 then add 0 to the value.

Subject: RE: Take a look at the Len function.

You can do that (if you have used the @formula language for years, and it’s what you’re used to, and comes naturally to you), or you can use the Format() function:

b=Format(a,“00”)

Subject: Making a 2 digit integer in lotusscript

You’ve got lots of answers to this, but I’d like to point out that you can not have an Integer with a value of 01. You can however have a String with a value of “01”.

Subject: RE: Making a 2 digit integer in lotusscript

Graham is absolutly right; note that to hold “01” as a value requires you to store it as a string, since 01 = 1 as far as an integer is concerned.

If you need to use the integer value; then I suggest keeping the integer value hidden and display the string version; then the integer version can be used for various calculations if required.

Nicolas Abesdris

Quintessence e-solutions Inc.