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?

>
EXPERT RESPONSE
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


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


    RELATED CONTENT
    Domino Designer
    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?
    Can the @Weekday function be manipulated for 14 days?

    Lotus Domino Designer
    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
    Top 10 Lotus Notes Domino programming and development tips of 2007
    A bevy of Notes/Domino development tips
    A smorgasbord of Notes/Domino development tips
    Lotus Notes' document check-in/check-out functionality

    LotusScript
    Display a custom message box using a LotusScript-generated button
    Can I use LotusScript to merge cells in a Microsoft Word table?
    Debug Lotus Notes documents using extracted data
    Extracting attachments from a Lotus Notes rich-text field
    Programmatically replace the design of Lotus Notes databases
    Reading a binary field in an Oracle database with LotusScript
    LotusScript equivalent of @Picklist for Lotus Notes
    Launch large attachments within an email from a Notes database
    How to find files on a hard drive or mapped network with LotusScript
    Update the ACL from the Roles view with LotusScript

    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



    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

    HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




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