I am trying to use the little known @ExpandNameList in Notes that resolves group names to users while also listing only unique names & resolving nested groups.
I am making the call from inside of Lotus Script behind a button click.
On the form I have two fields GroupName & GroupMemberListing. When the button is clicked I want the users associated with that group to be populated in the GroupMemberListing field.
Main problem I am having when I debug is that nothing is happenning (Meaning the GroupMemberListing does not even get a “” as I iterate through it in the debugger) in this line of code:
GroupMemberListing = Evaluate (| @ExpandNameList( “MAILSERVER”; | & EnteredGroup & | ) | )
I wanted to make this work via the web, but have had so many problems, I figured I would get it working via a regular form first then convert to web. Any help is appreciated.
Below is the entire code as follows:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim session As New NotesSession
Dim GroupMemberListing As Variant
Dim LookupValues As String
Dim EnteredGroup As String
Set uidoc = ws.CurrentDocument
EnteredGroup = uidoc.FieldGetText(“GroupName”)
GroupMemberListing = Evaluate (| @ExpandNameList( “MAILSERVER”; | & EnteredGroup & | ) | )
LookupValues = Join(GroupMemberListing,Chr(10))
Call uidoc.FIeldSetText(“GroupMemberListing”, LookupValues)
End Sub
CRISPY (I think)
Subject: Using Formula inside of LotusScript
Problem with this kind of requirement is that the formula must be a ‘constant’, i.e. the entire formula must be known at save/compile time.
U can try this
Replace EnteredGroup with a string of known value and it will work fine, but with variables it does not
U will have to write yr own code to do this.
Subject: Using Formula inside of LotusScript
Try this:GroupMemberListing = Evaluate (| @ExpandNameList( “MAILSERVER”; “| & EnteredGroup & |” ) | )
/Peter
Subject: RE: Using Formula inside of LotusScript
Peter thanks for you help, it worked perfectly. Putting the quotes before and after the pipes for the enteredgroup var did the trick. Kicking myself for overlooking such a simple thing! Odd looks like it does not have to be a constant. As long as the var value is known before getting to the line of formula seems to suffice.
Here is the complete code for reference:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim session As New NotesSession
Dim GroupMemberListing As Variant
Dim LookupValues As String
Dim EnteredGroup As String
Set uidoc = ws.CurrentDocument
EnteredGroup = uidoc.FieldGetText(“GroupName”)
GroupMemberListing = Evaluate (| @ExpandNameList( “MAILSERVER”; “| & EnteredGroup & |” ) | )
LookupValues = Join(GroupMemberListing,Chr(10))
Call uidoc.FieldSetText(“GroupMemberListing”, LookupValues)
End Sub
Subject: RE: Using Formula inside of LotusScript
Glad it worked!
/Peter