Reputation: 636
i have a problem to set numeric field in lotus notes script from uidoc, i have already tried:
but if "field" is numeric field and the value is a number(or a variable containing a number) i can't use fieldsettext method because field is initialized as text and i want numeric.
There is a method like fieldsetnumber or also like it ?
I don't want switch the document from uidoc to doc. thank's
Upvotes: 0
Views: 1209
Reputation: 86
It's worth remembering that you don't really 'switch' between the NotesUIDocument and NotesDocument - it's the same entity, just with a different set of classes.
The action you want to perform is never going to be 100% reliable with end users being able to change the format of the Date/Time field to suit themselves. Much better interacting with the backend and reloading the UIDoc.
What is the reason you don't want to use NotesDocument?
Nick
Upvotes: 1
Reputation: 720
If using FieldSetText, you have to be careful to format the value in a way that's consistent with the user's preferences and/or the settings of the field (e.g. whether the decimal separator is "," or "."). To avoid this source of error, it's better to use the NotesDocument object for this sort of thing. You need a better reason than "I don't want to," to not do this.
You could use the NotesDocument for this one operation and the NotesUIDocument for everything else, e.g. write:
uidoc.Document.ReplaceItemValue "fieldname", numbervalue
Unless you've deliberately set the option to not reload the UI automatically, this will do what you want. If you have set that option you'll need a second call to do that update.
Upvotes: 1
Reputation: 22266
uidoc.FieldSetText()
is the best option and when you save the value will be converted to the appropriate data type, at least according to the documentation.
Upvotes: 3