Manage Learn to apply best practices and optimize your operations.

Create a computed Lotus Notes field to list Personal Address Book names

Find out how to create a computed Lotus Notes field that generates a complete list of users in a specific Personal Address Book (names.nsf) group.

I recently needed to compose a computed Lotus Notes field that would list the Lotus Notes Name of every user in a particular group -- called "IT All" -- in my Personal Address Book (also known as the Domino Directory or names.nsf file).

I knew the group contained nested groups and I wanted to include the individuals in those groups as well.

Using several @transform commands and an @while loop, I was able to achieve this. The following Formula language code was the value of a computed, multi-valued text field.

groupname:="IT Programming";
startlist:=@Name([CN];
@DbLookup("":"NoCache";@Subset(@DbName;1):
"names.nsf";"(Groups for DbLookup)";groupname;
"Members")); @If(@IsError(startlist);"not found";@Do(

testlist:= @Transform( startlist ; "x" ;
  @Do(
templist:= @Name([CN];@DbLookup
("":"NoCache";@Subset(@DbName;1):"names.nsf";"
(Groups for DbLookup)";x;"Members"));
@If(@IsError(templist);"";"GroupFound")
));

LoopAgain:=@If(@IsMember("GroupFound";testlist);
"Yes";"No");
@While(
LoopAgain= "Yes";
startlist:=@Transform( startlist ; "x" ;
  @Do(
templist:=@Name([CN];@DbLookup
("":"NoCache";@Subset(@DbName;1):"names.nsf";"
(Groups for DbLookup)";x;"Members"));
 @If(@IsError(templist);x;templist))
  );
testlist:= @Transform( startlist ; "x" ;
  @Do(
templist:= @Name([CN];
@DbLookup("":"NoCache";@Subset(@DbName;1):
"names.nsf";"(Groups for DbLookup)";x;"Members"));
 @If(@IsError(templist);"";"GroupFound")
));
LoopAgain:=@If(@IsMember("GroupFound";
testlist);"Yes";"No")
);
startlist))

MEMBER FEEDBACK TO THIS TIP

This won't work well if you have a very large Personal Address Book. I suggest keeping the Domino Directory on a button that only executes when you click on it (to build/refresh the list). Using this code in a computed Lotus Notes field on the form would hinder application performance if it fired every time you opened a Lotus Notes document that contained it. Avoid keeping @DBLookups in computed Lotus Notes fields on forms.
—Andrew B.

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

I believe this is a simpler form, and it sorts the user names in alphabetical order:

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

I can't remember where I found the @ExpandNameList command -- it might have been on SearchDomino or IBM DeveloperWorks. My notes suggest that 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 Tandy Wine. 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.

This was last published in September 2007

Dig Deeper on Lotus Domino Directory

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close