Using LotusScript to retrieve names of fields on a Lotus Notes form
Learn what steps to take -- and some code to go along with it -- to retrieve names on a Lotus Notes form using LotusScript.
Is it possible to retrieve the names of fields from a particular Lotus Notes form using LotusScript?
Continue Reading This Article
Enjoy this article as well as all of our content, including E-Guides, news, tips and more.
You can use the "Fields" property of the NotesForm class in LotusScript to get a list of all Lotus Notes fields on a given form design element. The LotusScript code below was adapted from an example in the Domino Designer Help database:
Set db = session.CurrentDatabase Set form = db.GetForm("FORM_NAME") fieldCount = 0 msgString = "" Forall field In form.Fields fieldCount = fieldCount + 1 msgString = msgString & Chr(10) & " " & field End Forall Messagebox form.Name & " has " & fieldCount & " field(s):" & Chr(10) & MsgString
If you were really looking to get all of the fields on a specific Lotus Notes document, you could use the "Items" property of the NotesDocument class.
Dim ws As New NotesUIWorkspace Dim doc As NotesDocument Dim strFields As String Set doc = ws.CurrentDocument.Document Forall i In doc.Items strFields = strFields & Chr(10) & i.Name & " = " & i.Text End Forall Msgbox "Field Values: " & Chr(10) & strFields
Do you have comments on this Ask the Expert Q&A? Let us know.
Related information from SearchDomino.com:
- Tip: How to import data from Excel to a Lotus Notes form with LotusScript
- Expert Advice: Importing data from Microsoft Excel to a Lotus Notes form
- Tip: Create a computed Lotus Notes field to list Personal Address Book names
- Reference Center: Lotus Domino Designer
- Reference Center: LotusScript