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 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
($VIMGroups)"; List[n] ; 3))


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.


You could also use the undocumented @ExpandNameList function:


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)))



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 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 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

Dig Deeper on Lotus Notes Domino Formula Language

  • Favorite iSeries cheat sheets

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