Error in Evaluate Function

Posted on 2007-08-09
Last Modified: 2013-12-18

I am trying to use the evaluate function in lotusscript to determine whether the current user is a member of the Admin group.  I get the following when I try to save: "Error in Evaluate Macro".  Not very informative.

Here is the line of code:
eval = Evaluate(|@If{@IsMember("[Admin]"; @UserRoles); "y";"n"}|,db)

Thank you,

Question by:KDrago
    LVL 22

    Accepted Solution

    It takes a while to get used to using Evaluate.  Here, put this function in your library:

    Public Function IsGroupMember(Byval groupName As String) As Boolean
          Dim arrUserNameList As Variant
          Dim index As Variant
          arrUserNameList = Evaluate({@UserNamesList})
          index = Arraygetindex(arrUserNameList, groupName, 5)
          If (Isnull(index)) Then IsGroupMember = False Else IsGroupMember = True
    End Function
    LVL 63

    Expert Comment

    A general function hat I put in a script Library

    Function Gen_RoleEnabled(sRole As String) As Integer
          Dim vResult As Variant
          vResult = Evaluate(|@IsMember("| & sRole & |"; @UserRoles)|)
          If vResult(0) = 1 Then
                Gen_RoleEnabled = 1
                Gen_RoleEnabled= 0
          End If  'If vResult(0) = 1
    End Function

    I hope this helps !
    LVL 63

    Expert Comment

    If this is a group rather than a role in the ACL, then Bill has the correct method.

    LVL 19

    Expert Comment

    Sample code:
    Dim flag As String
          Dim uNameList As Variant
          flag = ""
          uNameList = Evaluate("@UserNamesList")
          Forall n In uNameList
                If (n = "[Admin]") Or (n = "[DeptHead]") Or (n="[Network]") Or (n="[Others]") Then
                      flag = "yes"
                      Exit Sub
                End If
          End Forall

    Author Comment

    I accidentally chose the wrong solution.  I meant to choose Bill-Hanson's solution.  Sorry to both.  I am trying to remedy this.
    LVL 22

    Expert Comment

    no worries.  glad to help.
    LVL 31

    Expert Comment

    Note that the only error in your original function was using {braces} instead of (parentheses).  Braces can be used in LotusScript to deliemit a string, instead of "double quotes." Many do this for Evaluate functions, so they don't have issues with using quotes as part of the formula.  You chose a third option, using |vertical bars| instead of "double quotes," but then got confused and used braces inside the @formula instead of (parentheses)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
    Article by: Rob
    Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now