Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Error in Evaluate Function

Posted on 2007-08-09
Medium Priority
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

Bill-Hanson earned 2000 total points
ID: 19662524
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

ID: 19662534
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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 19

Expert Comment

ID: 19662636
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

ID: 19663311
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

ID: 19663484
no worries.  glad to help.
LVL 31

Expert Comment

ID: 19673140
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)

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

578 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