To make a data connection, you have to program it. The easiest way to do this is to have one form for editing the field value and other forms that display the value without allowing editing. For simple field types -- keywords, numbers and so on -- this is easily done by making a Computed for Display field (CFD) on the non-editing forms and using another field on that form to look up the data from another document with a matching key. This key is an essential part of the equation. You can't just say that two documents are related to each other and share the same field data -- you have to have a way to specify how they're related. Maybe you have 3000 customer records that contain an editable phone number, and 100,000 sales order documents that should display the appropriate phone number. When you view a sales order, how is Notes supposed to know how to find the customer document that matches the current sales order? You have to specify this.
Let's say that on your sales order form, you select the customer from a keyword field named CustomerID. You have populated this field by using the Customers view to let the user select the customer from a view dialog, so the user sees the customer name and ID number in the selection dialog, but only the ID number is stored in your document. So you add a CFD CustomerName_d field (the _d is a naming convention I use so that I can easily spot which fields are CFD). Give the field a formula such as this:
@If(CustomerID = ""; ""; @IfError(@DbLookup(""; ""; "CustomersByID";This assumes there's a CustomersByID view that contains all the customers sorted by ID, with the customer name in column 2. This same view can be used to lookup other fields based on the customer ID -- address and phone number, perhaps.
CustomerID; 2); "unknown customer!"))
Note: To redisplay the value of looked-up fields after the key value changes, use the keyword field option "Refresh fields on keyword change."
It's also possible to create multiple forms that let you edit the same field, but this is significantly more complex. You must write code on the form -- probably in the Postsave event -- to automatically find and update all other documents that contain a copy of the same data. This works best if there is one replica of the application and one user at a time editing documents. Otherwise, the risk or replication/save conflicts is high, since each time you edit a document you are also modifying many other documents that you don't have open and that are not locked in your name (if you're using locking). Furthermore, if there are multiple replicas or if the application uses Readers fields, you risk problems of data inconsistency. You can't update documents that have not yet replicated to the current replica or documents to which you have no Reader access.
Dig Deeper on Lotus Notes Domino Formula Language
Related Q&A from Andre Guirard
Learn how you can use LotusScript and OLE to create and populate Microsoft Excel spreadsheets, as well as a little bit about Lotus Symphony. Continue Reading
Discover options you can use if you'd like external users to be able to access a workflow-based Notes Domino application through different ... Continue Reading
Learn why you may receive the error message: "Illegal circular use: Audit Trail" when trying to open Lotus Notes documents that use copied forms. Continue Reading