Search code examples
lotusscriptevaluate

using evaluate in lotusscript


I tried to get current user roles by using Lotus Script. And I'm using "Evaluate" method to get it so that I can used along with Formula Language. Below is the code

Dim test as Variant 

test = Evaluate("@UserRoles")       

If  test = "[Administrator]" Then                   
     Print "admin"
Else
     Print "Not admin"
End If  

But then, when I tried to run the code, I get this error : "type mismatch in method CheckOperand: Unknown found, Unknown expected"

Can someone who expert in Lotus Script give me your thought?


Solution

  • Evaluate is returning an array, so you need to perform the check accordingly.

    Dim roles as Variant 
    roles = Evaluate("@UserRoles") 
    Forall r in roles
        If r = "[Administrator]" Then
            Print "Admin"
        End If
    End ForAll