Domino Code Fragment

Code Name*
Populate Fields On Form Based On Selection of Keyword
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.144.189.177
Description*
This formula prompts the user to select a value and then populate additional fields on a form based on the selected value, (in this case to select from a list of Customer names being displayed in a view using the @DBColumn formula). This formula is typically used in a button, and is not recommended for large volumes of data that needs to be populated into a form, (use LotusScript to speed the population of data if this is a criteria).
Type*
Formula
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
This formula is good for small amounts of data being populated into a form based on a lookup to another database. It is not intended for large amounts of data as using LotusScript to populate the fields in the backend would be much faster.
Files/Graphics attachments (if applicable): Code:
REM "This formula looks up a list of Clients from a view titled (Company Info)";
REM "ReplicID is a hidden field in the formula that stores the replica ID for the database";
REM "being referenced";
List1 := @DbColumn("":"NoCache"; ReplicaID ; "(Company Info)"; 1);

REM "This formula displays the list created in the first formula in a select list and";
REM "prompts the user to pick from the list";
Choice := @Prompt([OKCANCELLIST]; "Customer";"Select the Customer"; List1; List1);

REM "This formula sets the Customer field to the value selected for Choice";
FIELD Customer := Choice;
"";

REM "This formula sets the value of the CustomerPhone number based on the value selected";
REM "as the choice for the customer. The error statement is provided to "trap" the error";
REM "if there is no phone number so that Notes does not display an error message";
REM "in the field if there is no value available";
FIELD CustomerPhone := @DbLookup("" : "NoCache"; ClientLocation ; "(Company Info)"; Choice; 10);
@If(@IsError(CustomerPhone); ""; CustomerPhone);


REM "The remaining formulas are performing similar lookups to populate other fields";
FIELD CustomerFax := @DbLookup("" : "NoCache"; ClientLocation ; "(Company Info)"; Choice; 2);
@If(@IsError(CustomerFax); ""; CustomerFax);
FIELD CustomerAddress:= @DbLookup("" : "NoCache"; ClientLocation ; "(Company Info)"; Choice; 6);
@If(@IsError(CustomerAddress); ""; CustomerAddress);
FIELD CustomerCity:= @DbLookup("" : "NoCache"; ClientLocation ; "(Company Info)"; Choice; 7);
@If(@IsError(CustomerCity); ""; CustomerCity);
FIELD CustomerState:= @DbLookup("" : "NoCache"; ClientLocation ; "(Company Info)"; Choice; 8);
@If(@IsError(CustomerState); ""; CustomerState);
FIELD CustomerZip:= @DbLookup("" : "NoCache"; ClientLocation ; "(Company Info)"; Choice; 9);
@If(@IsError(CustomerZip); ""; CustomerZip)