Domino Code Fragment

Code Name*
Calculate current relative directory on Server
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.15.221.67
Description*
This formula calculates the current relative directory on the current server. You can append a filename of a database expected to be found in the same directory in order to access it. This formula allows you to install a suite of databases which will always access each other within the SAME DIRECTORY. Either server-relative paths or full local drive-directory paths will work Note: You also need a formula to compute the server name. This is simply: @Subset( @DbName; 1 ). To get fancier, check the platform using @Platform and use the ! separator for the Macintosh.
Type*
Formula
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
REM "This is the target database we want to access.";
TargetDb := "config.nsf";
REM "Get the name of the server on which this DB is located.";
SrvDb := @DbName;
REM "Find the path to the Config DB in this file directory.";
DbStr := @Subset(SrvDb; - 1);
LenDbStr := @Subset(@Length(DbStr); 1);
DbNameStr := @RightBack(DbStr; "\\");
LenDbNameStr := @Subset(@Length(DbNameStr); 1);

DbDirStr := @Left(DbStr; LenDbStr - LenDbNameStr);
DbPrefix :=
@If(
@Contains(DbStr; "\\");
DbDirStr;
""
);
REM "Finally we prepend the path to our target database filename.";
DbPrefix + TargetDb;