Manage Learn to apply best practices and optimize your operations.

Retrieve Lotus Notes names from a nested group using @DBLookup

Discover how to retrieve a list of Lotus Notes names from a nested group using the @DBLookup command and Formula language code, courtesy of SearchDomino.com member Mike Bryant.

Having problems using the @DBLookup command to retrieve a list of Lotus Notes names from a group that contains other groups (also known as a "nested group")?

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.

MEMBER FEEDBACK TO THIS TIP

You could also use the undocumented @ExpandNameList function:

@ExpandNameList
(ServerName;GroupName)

This function is undocumented, so it's not officially supported and may go away in a future release. It does, however, still work in Lotus Notes Domino 8 and has been around at least since version 5. Most likely, it won't be removed soon.
—Tim T.

******************************************

You could also use the following Formula language code:

@Sort(@Name([CN] ;
@ExpandNameList(Server : 
Database; Group)))


—A.L.

******************************************

I believe this is a simpler form:

Group := "IT Programming; 
Server := ""; 
Database := "names.nsf"; 
@Sort(@Name([CN] ; 
@ExpandNameList(Server : 
Database; Group)))

I can't remember where I found the @ExpandNameList function; it might have been on SearchDomino.com or the IBM DeveloperWorks page (it isn't in 6.5.1 Designer Help). My notes suggest it's been around for at least two years.
—Ross B.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Mike Bryant. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Related resources from SearchDomino.com:

Dig Deeper on Lotus Notes Domino Formula Language

SearchWindowsServer
Search400
  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

SearchDataCenter
SearchContentManagement
Close