If you use editable Name field (or author/reader) and you want to ensure that the name entered is listed in your address book, put this code in the validation formula of your field.
- This allows you to specifically define which Directory you want to look in... In my example I am looking at the names.nsf database at the root of the user server...
- This works only for single value field.
@If( @Name([O]; YOURFIELD) != "" ; @Return(YOURFIELD) ;
YOURFIELD ="" ; @Return("") ; "");
result :=@DbLookup("" ; @Subset(@MailDbName;1) : "names.nsf" ; "($Users)" ;
YOURFIELD ; "FullName" );
@If( @IsError(result) ;@Do( @Prompt([OK];"Erreur";"Unable to find the name in the adress book"); @Return(""));
@Elements(result)=1;@Return(result); "") ;
REM " C'est pas fini !";
result2:= @Replace(@Name([O];result ) ; "" ; "");
result3 := @Trim(@Replace(result; result+result2 ; "" ));
@If(@Elements(result3) = 1 ;@Return(result3) ;"" );
@Prompt ([OKCANCELLIST];"Homonyms" ; "Several names are matching" ;
@Subset(result3;1) ;result3 )