Need some help with LotusScript

Up until recently I’ve done all my code in formula language and if I couldn’t do it in forumula language it didn’t get done. I’ve been trying to learn LS but have had a real hard time finding any books for a beginner. So if anyone can recommend a good book on LotusScript and interfacing with notes databases I’d really appreciate it.

So the little bit of LS I’ve learned is similair to VB. Message boxes, for/next loops, arrays, etc. So using a command button I can ask the user for an integer, create an array based on that integer, and cycle through a loop to ask for values for each part of the array. That’s great but I have no idea how to take that input and pass it back to a field on the form. Not even sure where to start. Can anyone point me in the right direction?

Subject: Need some help with LotusScript

If you want to update a document that’s currently open… you should check out the NotesUI* classes (the “front-end” classes).

A quick example:

Dim ui as New NotesUIWorkspace()

dim uidoc as NotesUIDocument

Set uidoc = ui.CurrentDocument

Call uidoc.FieldSetText(“FieldName”, “New Value”)

Not sure of any books. Perhaps one of the IBM Redbooks?

Cheers

E

Subject: Need some help with LotusScript

Link to free on-line LS course can be found here:

http://www.dominopower.com/issues/issue200609/00001853001.html

Subject: Need some help with LotusScript

How about this -

http://www-12.lotus.com/ldd/doc/uafiles.nsf/docs/ls70/$File/lscript.pdf

Contains everything about LS. For knowing about NotesClasses you need to go through Lotus Designer Help Documentation.

–Phani

Subject: TLCC has distance learning LS courses including a free demo

Howard

Subject: Need some help with LotusScript

I remember those feelings. I have found the best help to be the Notes on-line documentation. In my designer, the home page shows the Domino Objects for LotusScript and OLE. From there it is easy to click on an object and learn what properties and methods are available to me. Don’t forget that F1 brings up the designer help (if in designer when pressing F1). Alt+2 puts it in index order for view-like searching.

A couple of tricks I have found that helped me.

In the (Globals)Declaration area of your form (it is at the top of the list, you usually have to click on the plus key to show it), Dim two objects:

 Dim UIDoc as NotesUIDocument

 Dim Doc as NotesDocument

Then in the form’s PostOpen event, set these objects

 Set UIDoc = Source

 Set Doc = UIDoc.Document

By declaring those objects as public and setting them in the PostOpen event, they are always available to you; in a field’s Entering and Exiting event, in any button or action you create for the form, basically anywhere.

From there study the help about how to get to the fields and data. From the UIDoc use var = UIDoc.FieldGetText(“Fieldname”) and Call UIDoc.FieldSetText(“Fieldname”, value). From the Doc use var = Doc.Fieldname(0) and Doc.Fieldname = var. Remember that UI refers to what the user sees (“front-end”), so the UIDoc is what is displayed on the screen, while Doc is the “back-end” or what is stored on disk. This is important when working with fields which contain synonyms, i.e. Texas|TX. The UIDoc would return “Texas” while the Doc would return “TX”.

The other thing to remember is that Notes considers all fields to be an array of data. Therefore to get the data from a field on a document, it is var = Doc.Fieldname(0).

Good luck and enjoy. While LotusScript is powerful and even fun, don’t forget the Formula language. In the right circumstances a few formula commands can be faster than comparable script code.

–Ron