How to use FieldSetText for a number field

Hello Everyone:

I am having trouble using the fieldsettext to assign the value of a number field. If I read the help file correctly it is supposed to change it to a number when the file gets saved. I am using this code in the querysave and I get the number to be used from another file and stored it in a long variable. I change it to a string using Cstr inside the call to the fieldsettext and when the file is saved it is save as text. The field is used in another process and it gives an error because it is text an not a number. Please any advise!!!

Thanks

Subject: How to use FieldSetText for a number field

Can we see the code please ?

All fields in the UIDocument are text, and are converted to Numbers in the Document if and only if the form field is identified as a number. So if you are updating a UI field, this should work. (If you are using FieldSetText, this should be working for you.)

If, however, you are updating an NotesItem in the NotesDocument, then there is no automatic conversion, and if you need a number, you need to set the item’s value to a number.

Subject: How to use FieldSetText for a number field (the code)

Hello here is the code:

I get the value from another document

intkey = doc.nextordernumber(0)

and now I apply the value to the field

Call source.FieldSetText(“OrderNum”,Trim(Cstr(Intkey)))

In the form the field is

Number

Computed

notes style

decimal

0 fixed decimal places

I don’t know what the problem is and why it is saved as text.

Thanks

Subject: RE: How to use FieldSetText for a number field (the code)

First, let’s see what’s actually happening. Add these lines to your code, and debug the script. What is the value of X ? Does it have any spaces in it ?

X = Trim(Cstr(Intkey)

stop

Call source.FieldSetText(“OrderNum”,Trim(Cstr(Intkey)))

Secondly, you said that OrderNum was computed. What is it’s computational formula ?