Reference Lookup
Bookmark :
Here is another library template called Reference Lookup that I use when developing Domino applications. The goal of this library is to remove all hard coding of servers and file paths with aliases. Originally this was developed for Formula language but has sense been expanded to LotusScript and Java. I have also expanded the concepts of servers and paths to URLs and local file paths.
Here is another library template called Reference Lookup that I use when developing Domino applications. The goal of this library is to remove all hard coding of servers and file paths with aliases. Originally this was developed for Formula language but has sense been expanded to LotusScript and Java. I have also expanded the concepts of servers and paths to URLs and local file paths.
I used Quick Elementer so you can easly impement the Formula, LotusScript or Java Version. I also created Quick Elementer Code starters that can be used to get a jump start on the code needed to use Reference Lookup. The LotusScript and Java will return the reference object or Notes Database. Using the following logic:

Formula code starters can return the database based on the current server or the users mail server.
REM "Get the Reference database based off the current server.";
ReferenceAlias := "<enter reference alias here>";
NewLookupDb := @Explode( @Explode( @DbLookup("" : "NoCache" ; @DbName ; "(Reference Lookup)"; @Subset( @Name( [CN] ; @DbName ) ; 1 ) + ReferenceAlias ; 3 ) ; "," ); ":" ; @True ) ;
NewDatabase := @If( @IsError( NewLookupDB ) ;
@Return( @Prompt( [OK] ; "Unable to continue. " ; "Unable to find: " + ReferenceAlias ) );
NewLookupDB);
ReferenceAlias := "<enter reference alias here>";
NewLookupDb := @Explode( @Explode( @DbLookup("" : "NoCache" ; @DbName ; "(Reference Lookup)"; @Subset( @Name( [CN] ; @DbName ) ; 1 ) + ReferenceAlias ; 3 ) ; "," ); ":" ; @True ) ;
NewDatabase := @If( @IsError( NewLookupDB ) ;
@Return( @Prompt( [OK] ; "Unable to continue. " ; "Unable to find: " + ReferenceAlias ) );
NewLookupDB);
There are also starters for @DBLookup, @DBColumn and @PickList.
REM "First Check based off the current server. If that returns error then check based off their Home mail server.";
ReferenceAlias := "<enter reference alias here>";
CurrentServer := @True/@False;
View := "<view Name>";
ViewKey := <value to lookup on the first sorted column>;
ViewReturn := <view column number or field name to return>;
ErrorCheck := @True/@False;
CacheLookup := @True/@False;
LookupDb := @Explode( @DbLookup("" : "NoCache" ; @DbName ; "(Reference Lookup)"; @if( CurrentServer ; "*" ; @Subset( @Name( [CN] ; @DbName ) ; 1 ) ) + ReferenceAlias ; 3 ) ; "," );
NewLookupDB := @Explode( @If( LookupDB = "" | @IsError( LookupDB ) ;
@Explode( @DbLookup("" : "NoCache"; @DbName ; "(Reference Lookup)" ; @Name( [CN] ; @Environment( "MailServer" ) ) + ReferenceAlias ; 3 ) ; "," );
LookupDB ) ; ":" ; @True ) ;
TempReturn := @If( @IsError( NewLookupDB ) ;
@Prompt( [OK] ; "Unable to continue. " ; "Unable to find: " + ReferenceAlias ) ;
@DbLookup( @If( CacheLookup ; "" ; "":"NoCache" ) ; @if( @SubSet( NewLookupDB ; 1 ) = "*" ; @Subset( @Name( [CN] ; @DbName ) ; 1 ) : @SubSet( NewLookupDB ; -1 ) ; NewLookupDB ) ; View ; ViewKey ; ViewReturn ) );
@If( ErrorCheck ;
@If( @IsError( TempReturn ) | TempReturn = "";
@Return("") ;
TempReturn ) ;
TempReturn );
ReferenceAlias := "<enter reference alias here>";
CurrentServer := @True/@False;
View := "<view Name>";
ViewKey := <value to lookup on the first sorted column>;
ViewReturn := <view column number or field name to return>;
ErrorCheck := @True/@False;
CacheLookup := @True/@False;
LookupDb := @Explode( @DbLookup("" : "NoCache" ; @DbName ; "(Reference Lookup)"; @if( CurrentServer ; "*" ; @Subset( @Name( [CN] ; @DbName ) ; 1 ) ) + ReferenceAlias ; 3 ) ; "," );
NewLookupDB := @Explode( @If( LookupDB = "" | @IsError( LookupDB ) ;
@Explode( @DbLookup("" : "NoCache"; @DbName ; "(Reference Lookup)" ; @Name( [CN] ; @Environment( "MailServer" ) ) + ReferenceAlias ; 3 ) ; "," );
LookupDB ) ; ":" ; @True ) ;
TempReturn := @If( @IsError( NewLookupDB ) ;
@Prompt( [OK] ; "Unable to continue. " ; "Unable to find: " + ReferenceAlias ) ;
@DbLookup( @If( CacheLookup ; "" ; "":"NoCache" ) ; @if( @SubSet( NewLookupDB ; 1 ) = "*" ; @Subset( @Name( [CN] ; @DbName ) ; 1 ) : @SubSet( NewLookupDB ; -1 ) ; NewLookupDB ) ; View ; ViewKey ; ViewReturn ) );
@If( ErrorCheck ;
@If( @IsError( TempReturn ) | TempReturn = "";
@Return("") ;
TempReturn ) ;
TempReturn );
Here is the starter code for populating a keyword options with alias.
REM "First Check based off the current server. If that returns error then check based off their Home mail server.";
ReferenceAlias := "<enter reference alias here>";
View := "<view Name>";
ViewReturn := <view column number or field name to return>;
Wordseparator := "<word number to display>";
DisplayWord := <word number to display>;
AliasWord := <word number as the alias>;
ErrorCheck := @True/@False;
CacheLookup := @True/@False;
LookupDb := @Explode( @DbLookup("" : "NoCache" ; @DbName ; "(Reference Lookup)"; @Subset( @Name( [CN] ; @DbName ) ; 1 ) + ReferenceAlias ; 3 ) ; "," );
NewLookupDB := @Explode( @If( LookupDB = "" | @IsError( LookupDB ) ;
@Explode( @DbLookup("" : "NoCache"; @DbName ; "(Reference Lookup)" ; @Name( [CN] ; @Environment( "MailServer" ) ) + ReferenceAlias ; 3 ) ; "," );
LookupDB ) ; ":" ; @True ) ;
TempReturn := @If( @IsError( NewLookupDB ) ;
@Prompt( [OK] ; "Unable to continue. " ; "Unable to find: " + ReferenceAlias) ;
@DbColumn( @If( CacheLookup ; "" ; "":"NoCache" ) ; @if( @SubSet( NewLookupDB ; 1 ) = "*" ; @Subset( @Name( [CN] ; @DbName ) ; 1 ) : @SubSet( NewLookupDB ; -1 ) ; NewLookupDB ) ; View ; ViewReturn ) );
ReturnValue := @If( ErrorCheck ;
@If( @IsError( TempReturn ) | TempReturn = "";
@Return("") ;
TempReturn ) ;
TempReturn );
@Word( ReturnValue ; Wordseparator ; DisplayWord ) + "|" + @Word( ReturnValue ; Wordseparator ; AliasWord )
ReferenceAlias := "<enter reference alias here>";
View := "<view Name>";
ViewReturn := <view column number or field name to return>;
Wordseparator := "<word number to display>";
DisplayWord := <word number to display>;
AliasWord := <word number as the alias>;
ErrorCheck := @True/@False;
CacheLookup := @True/@False;
LookupDb := @Explode( @DbLookup("" : "NoCache" ; @DbName ; "(Reference Lookup)"; @Subset( @Name( [CN] ; @DbName ) ; 1 ) + ReferenceAlias ; 3 ) ; "," );
NewLookupDB := @Explode( @If( LookupDB = "" | @IsError( LookupDB ) ;
@Explode( @DbLookup("" : "NoCache"; @DbName ; "(Reference Lookup)" ; @Name( [CN] ; @Environment( "MailServer" ) ) + ReferenceAlias ; 3 ) ; "," );
LookupDB ) ; ":" ; @True ) ;
TempReturn := @If( @IsError( NewLookupDB ) ;
@Prompt( [OK] ; "Unable to continue. " ; "Unable to find: " + ReferenceAlias) ;
@DbColumn( @If( CacheLookup ; "" ; "":"NoCache" ) ; @if( @SubSet( NewLookupDB ; 1 ) = "*" ; @Subset( @Name( [CN] ; @DbName ) ; 1 ) : @SubSet( NewLookupDB ; -1 ) ; NewLookupDB ) ; View ; ViewReturn ) );
ReturnValue := @If( ErrorCheck ;
@If( @IsError( TempReturn ) | TempReturn = "";
@Return("") ;
TempReturn ) ;
TempReturn );
@Word( ReturnValue ; Wordseparator ; DisplayWord ) + "|" + @Word( ReturnValue ; Wordseparator ; AliasWord )
Download Reference Lookup






