NAM Lookup button

I have used some code posted here to create a Phone ext lookup button on the toolbar. Below is a snippet of code and a results box. Problem is I have 4 employees with the first names starting with Chris…Chris Przybysz

Chris Stone

Christina McLeod

Christy Sabatino

The results in the box are:

Chris Przybysz

Christina Stone

Christy McLeod

Christy Sabatino

I believe it is the @Unique code that is trapping the first Chris it sees replacing it with the next name. Anyone know how to resolve this?

tempname := @Trim(@Prompt([OkCancelEdit]; “Ext. Lookup”; “Enter surname (eg. smith), firstname (eg. jane), or fullname (eg. jane smith).”;“”));

surname := @If(@RightBack(tempname; " ") = “”; tempname;@RightBack(tempname; " "));

templist1 := @DbLookup(“”: “NoCache”; server; “($Users)”; tempname; 2);

templist2 := @If(@IsError(templist1); @DbLookup(“”: “NoCache”; server; “($Users)”; tempname; 2; [PartialMatch]); templist1);

templist3 := @If(@IsError(templist2); @Do(@Prompt([Ok]; “ePhone Error”;

“The name " + tempname + " you entered was not found in the address book. Please try again”; “”); @Return(0)); templist2);

templist4 := @DbLookup(“” ; server; “($Users)”; templist3;“OfficePhoneNumber”);

templist7:=@DbLookup(“” ; server; “($Users)”;templist3;“Firstname”);

templist8:=@DbLookup(“” ; server; “($Users)”;templist3;“Lastname”);

phonelist := @Unique(templist7) + " " + @Unique(templist8) + " " + "Extension: " + @Unique(templist4);

@Prompt([OkCancelList]; “Ext. Lookup”; "List of names and numbers. "; “”; phonelist)

Subject: NAB Lookup Button

I figured it out. In this line of code: phonelist := @Unique(templist7) + " " + @Unique(templist8) + " " + "Extension: " + @Unique(templist4);

it should have been: phonelist := @Unique(templist7 + " " + templist8 + " " + "Extension: " + templist4);