Need help with fieldgettext for use with number

I am currently using LotusScript and an ODBC connection to lookup data in a Microsoft Access Table. During testing it worked perfectly. When I changed the code to reflect the live database it failed.

One of the lines being used is FieldGetText and the name of the field. I’m guessing the reason this worked before is because the number being looked up was a text field. The live table has a number formatted as a number.

I tried changing the field type in designer to number, but it still fails. I’m thinking this is due to the code stating “FieldgetText”, but don’t know enough about LotusScript to know for sure.

Any suggestions? Thank you in advance.

Subject: Need help with fieldgettext for use with number

Melissa,

If you are using FieldGetText, you are obviously doing your manipulation in the front end…why not access the value from the backend doc which will allow you to access the value as its true value and not as a converted text string?

just an idea.

brandt

Subject: RE: Need help with fieldgettext for use with number

Unfortunately I have little LotusScript experience, so I’m not sure where to go with your suggestion. Can you provide an example? Thank you very much.

Subject: RE: Need help with fieldgettext for use with number

Melissa,

Via LS, you can access a document in one of two ways.

  1. Through the UI–this is the way you are doing it…you are accessing the data values as they appear on the screen for the user.

  2. Through the backend document. This is the document as it exists without the UI…there is no form, merely a document and fields.

While you can manipulate data values via the UI, it is limiting. When you access data via fieldgettext in the NotesUIDocument object, you receive a text string…however, in your example, you need the data as a numeric value and this is where your problem occurs. sure, maybe you defined the field in question as a numeric field, but when you grab the value via FieldGetText you are actually just grabbing the value BEFORE it gets validated as the correct data type. thus it will only return values as a string and not another datatype.

I really need to draw a picture here, but imagine that you have a person’s face and a mask. The mask represents the form and only shows certain parts of the person’s face to the world–eyes, mouth, maybe hair, but the rest is covered. That is your form or NotesUIDocument. What you don’t see however are the hidden fields–in this case, the nose, the cheeks, etc. When you access the data via the backend document, you can access all of that hidden data as well as the exposed data, but it is in the data format you expect.

So for example the line value = uidoc.FieldGetText(“Number”) will return a string, but in the backend doc value= doc.Number(0) will return the number value you seek.

Really, you probably need to take a course on LS or find online coursework to get a handle on the backend v. frontend usage. However, in the Notes help, I would look at the Document method of the NotesUIDocument class as well as the entry for the NotesDocument class.

brandt

Subject: RE: Need help with fieldgettext for use with number

Thank you very much for your assistance. I DEFINITELY need a course in LotusScript. I am fine with manipulating current code, or with writing @functions and commands, but have not had LS training.

Thank you again!