Link to home
Start Free TrialLog in
Avatar of bobdraz
bobdraz

asked on

Profile Doc Field Names problem

I'm having trouble reading 3 fields on a Profile document. The three variables

                Dim fldnameApprv As String
      Dim fldnameBkupApprv As String
      Dim fldnameDoer As String

are populating with the correct field names being passed from another function:

                fldnameApprv = "fldPrflAppvr" +  (stName)
      fldnameBkupApprv = "fldPrflBkupAppv" + (stName)
      fldnameDoer = "fldPrflDoer" + (stName)

How can I plug in these field names so the following lines work:


If prfdoc.fldnameApprv <> "" Then
      getProfile = prfdoc.fldnameApprv + (stName)
Else
      If prfdoc.fldnameBkupApprv + (stName) <> "" Then
            getProfile = prfdoc.fldnameBkupApprv + (stName)
      Else
           If prfdoc.fldnameDoer + (stName) <> "" Then
            getProfile = prfdoc.fldnameDoer + (stName)


Here's the whole function code.

Function getProfile (stName) As String
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim prfdoc As NotesDocument
      Dim fldnameApprv As String
      Dim fldnameBkupApprv As String
      Dim fldnameDoer As String
      Set db = session.CurrentDatabase
      Set prfdoc = db.GetProfileDocument("ProfileDoc")
      fldnameApprv = "fldPrflAppvr" +  (stName)
      fldnameBkupApprv = "fldPrflBkupAppv" + (stName)
      fldnameDoer = "fldPrflDoer" + (stName)
      If prfdoc.fldnameApprv <> "" Then
            getProfile = prfdoc.fldnameApprv + (stName)
      Else
            If prfdoc.fldnameBkupApprv + (stName) <> "" Then
                  getProfile = prfdoc.fldnameBkupApprv + (stName)
            Else
                  If prfdoc.fldnameDoer + (stName) <> "" Then
                        getProfile = prfdoc.fldnameDoer + (stName)
                  End If
            End If
      End If      
      
End Function
ASKER CERTIFIED SOLUTION
Avatar of qwaletee
qwaletee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of qwaletee
qwaletee

Oops, I think it is getItemValue, not getItemValues
Avatar of bobdraz

ASKER

I get a Type Mismatch on the following:

If prfdoc.getItemValue(fldnameApprv) <> "" Then

The end result I looking for is the contents of the field. Of the three fields, the first that isn't equal to spaces is the value I want to pass back from this function.
      
try this

If prfdoc.getItemValue(fldnameApprv)(0) <> "" Then


~Hemanth
Avatar of bobdraz

ASKER

That got me past the Mismatch Type, but it doesn't seem to recognize that the first field is not equal to spaces. There is text data ("AS") in the first field.

If prfdoc.getItemValue(fldnameApprv)(0)<> "" Then
      getProfile = prfdoc.getItemValue(fldnameApprv)
Else
      If prfdoc.getItemValue(fldnameBkupApprv)(0)<> "" Then
            getProfile = prfdoc.getItemValue(fldnameBkupApprv)
      Else
            If prfdoc.getItemValue(fldnameDoer)(0) <> "" Then
                  getProfile = prfdoc.getItemValue(fldnameDoer)
            End If
      End If
End If      
      
Avatar of bobdraz

ASKER

I should mention that prfdoc.getItemValue(fldnameApprv)(0) returns the field name and not the field contents.
Avatar of bobdraz

ASKER

Just to mention, I'm passing the field name I want the content of to this function. I need to plug in that field name and get the contents from the profile doc in this fuction. What I get is the field name itself. - Help...
Sorry I didn't respond back here... I did respond in your new question.