| This Formula language code retrieves the list of values in a Lotus Notes nested |
| group, and then adds them to a list one by one -- as a common name if it's a |
| person, or by looking up the values if it's a group. |
| All you need to do is: |
| 1. Copy the Formula language code below. |
| 2. Paste it into a computed, multi-value field. |
| 3. Change the group name to match yours. |
| 4. Run the code. |
| You can also add error trapping for the lookups as needed. |
| db := "names.nsf"; |
| svr := @Subset(@DbName;1); |
| luKey := "YourGroupNameGoesHere"; |
| List := @DbLookup("":"NoCache"; |
| svr: db; "($VIMGroups)"; luKey; 3); |
| @Unique(@Name([CN]; List)); |
| |
| @For(n := 1; n <= @Elements(List); |
| n := n + 1; @If( (@Left(List[n] ; 2) = "CN") ; |
| temp := temp : @Name([CN] ; List[n]); |
| temp := temp : @Name([CN] ; @DbLookup |
| ("":"NoCache";svr:db;"($VIMGroups)"; List[n] ; 3)) |
| ) |
| ); |
| |
| @Sort(temp) |
| |
| Note: This tip will only work if you are using Lotus Notes Domino R6.x or |
| greater. I know this may not always work for everyone, but it solved a lot of |
| headaches for me. |
| |
| |
| ################################################################################ |
| ########### |
| In R6, @expandgrouplist doesn't seem to work anymore. This @formula will get |
| all members of groups, and it will also work for nested groups. |
| |
| Code |
| |
| ndb := @ServerName:"names.nsf"; |
| vfield:=@IfError(@DbLookup |
| ("":"nocache";ndb;"($Users)";Group;"Members"); |
| group); |
| REM {Store result here}; |
| resultList:=""; |
| REM {List of processed groups to avoid infinite loops}; |
| processGroups:=""; counter:=0; @While(@Trim(vfield)!= ""; |
| allv := @Trim(vfield); |
| current := allv[1]; |
| |
| type := @NameLookup([noupdate];current;"Type"); |
| @if( @LowerCase(type)="group"; |
| @Do( |
| add:= @If( @IsMember(current;processGroups); |
| ""; |
| @IfError(@DbLookup("":"nocache";ndb;" |
| ($Users)";current;"Members");current)); |
| @If(@Trim(add)=""; |
| resultlist:=resultlist:add; |
| add=current; |
| resultlist:=resultlist:add; |
| resultList:=@Replace(resultList:add;current;"") |
| ); |
| processGroups:=@Trim(processGroups:current); |
| vfield:=@Trim(@Replace(allv;current;""):add) |
| ); |
| @Do( |
| resultList:=resultList:current; |
| vfield:=@Trim(@Replace(allv;current;"")) |
| ) |
| ); |
| @StatusBar(@Text(counter)+" - "+ |
| @text(@Elements(vfield))+") > " + vfield[1] + "..."); |
| counter:=counter+1 |
| ); |
| @Trim(@Unique(resultList)) |
| |
| MEMBER FEEDBACK TO THIS TIP |
| This solution is limited to R6 but it sure is simple. |
| REM {This formula expands a group name 3 levels deep.} |
| |
| resultList := group; |
| @For(n := 1;n <= 3;n := n + 1; |
| resultList := @Transform(resultList;"var"; |
| @IfError(@DbLookup("";"85256648:005C15D7"; |
| "Groups"; var; "Members");var))); |
| @Trim(@Unique(resultList)); |
| |
| —Bruce F. |
| ************************ |
| A simpler solution that works fine in Notes 6 is: |
| @ExpandNameList(Server : Database; GroupName) |
| —J. Herman |