Is it possible to retrieve the names of fields from a particular Lotus Notes form using LotusScript?
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
Dig Deeper on Lotus Domino Designer
Related Q&A from Brad Balassaitis
Upon moving to Lotus Notes 8, some Lotus Notes users received an error message stating: 'Database has not been opened yet.' Find out why here. Continue Reading
Discover what security settings you need to fix if you encounter the Lotus Notes database error: 'database is not opened yet.' Continue Reading
Learn the Formula language code that you can use if you'd like your Lotus Notes form with embedded views to stop displaying all response documents. Continue Reading