IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Technical Library
developerWorks

[Back to Developing an advanced settings tool]

STGGetSettingValue function

Const C_SETTINGS_VIEW = "vwLookSettings"

Public Function STGGetDocument (strView As String, strKey As String) As NotesDocument
    ' Given a doc's view and key, return the doc
    Dim s As New NotesSession
    Set STGGetDocument = s.CurrentDatabase.GetView(strView).GetDocumentByKey(strKey,True)
End Function 'STGGetDocument

Public Function STGGetSettingValue (strName As String) As Variant
    ' Created by Jonathan Coombs on 9-15-2000
    ' Given a Setting doc's key, look up the doc and return the appropriate field value as a variant
    ' Use the type field to determine which value field to use. Only return an array if the setting type
    ' supports multiple values.
    ' This function provides the Settings tool with a degree of modularity. If you use it to handle
    ' all of your lookups, none of your calling code needs to directly refer to the fields on frmSetting.
    ' Warning: The "r1" type is not yet fully supported. See STGTest() and STGGetSettingRTF() for details.

    Dim doc As NotesDocument, item As NotesItem
    Dim strType As String, strError As String, varReturn As Variant

    'If an error occurs, ignore it and return null
    strError = ""
    On Error Goto tagError

    Set doc = STGGetDocument (C_SETTINGS_VIEW, strName)
    strType = Lcase$ ( Cstr ( doc.fType(0) ) )

    Select Case strType
    Case "t1"
      varReturn = doc.fValue(0)
    Case "tm"
      varReturn = doc.fValues
    Case "n1"
      varReturn = doc.fValueName(0)
    Case "nm"
      varReturn = doc.fValueNames
    Case "r1"
      'Warning: This case currently only works in debug mode.
      Set item = doc.GetFirstItem ("fValueRich")
      Set varReturn = item 'Warning: This will return an object, not a simple value
    Case "d1"
      varReturn = doc.fValueDate(0)
    Case "s1"
      varReturn = doc.fValueRadio(0)
    Case "sm"
      varReturn = doc.fValueCheck
    Case Else
      varReturn = strError
    End Select

tagEnd:
    If strType = "r1" Then
      Set STGGetSettingValue = varReturn
    Else
      STGGetSettingValue = varReturn
    End If
    Exit Function

tagError:
    varReturn = strError
    Resume tagEnd

End Function 'STGGetSettingValue
    About IBM Privacy Contact