Home > Ask the Domino Experts > Domino Designer Questions & Answers > Using LotusScript to retrieve names of fields on a Lotus Notes form
Ask The Domino Expert: Questions & Answers
EMAIL THIS

Using LotusScript to retrieve names of fields on a Lotus Notes form

Brad Balassaitis EXPERT RESPONSE FROM: Brad Balassaitis

Pose a Question
Other Domino Categories
Meet all Domino Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 29 January 2008
Is it possible to retrieve the names of fields from a particular Lotus Notes form using LotusScript?


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Domino Designer
Resolve Notes 8 migration error: 'Database has not been opened yet'
Lotus Notes access error: 'database is not opened yet'
Stop response documents from showing in a Lotus Notes form
Set a value in a field existing in another Lotus Notes database
Create an automatic scheduled view export in Excel
Display Lotus Notes fields as separate entries in one column
Creating custom Lotus Notes Domino login forms
Importing data from Microsoft Excel to a Lotus Notes form
Error creating product object
Is LotusScript needed to validate fields on form?

Lotus Domino Designer
Setting up a Domino 8.5 XPages example
An introduction to using XPages in Domino 8.5
Top 10 Lotus Notes/Domino coding and development tips of 2008
'Customize this view' options are disabled in Lotus Notes databases
Stop response documents from showing in a Lotus Notes form
Set a value in a field existing in another Lotus Notes database
Display Lotus Notes fields as separate entries in one column
An introduction to Lotus Domino Designer
Modifying LotusScript code for date and time handling
Creating custom Lotus Notes Domino login forms

LotusScript
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
Run or restart Notes/Domino agents via text messages
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


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




  • Search and Browse the Expert Answer Center
    Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
    Browse our Expert Advice



    Lotus Notes Domino on Blackberry and mobile devices
    HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




    All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts