Problem solve Get help with specific problems with your technologies, process and projects.

How can I allow a file to read from two shared fields?

I have a problem in Domino Designer. I had created a file in a shared field. I want to allow access from more than two fields, but I am having trouble. Please tell me how I can show the data that is input to another field.
I think you misunderstand what a shared field is. What you are sharing is the design of the field -- the datatype, input translation formula and so forth -- not the data that you might have entered into the field in one document or another. There is nothing you can do with a shared field that you can't do by just manually creating a field with the same properties as some field on another form. All it does is simplify maintenance of the field design. There is no data connection between different forms that use the same shared field.

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";
CustomerID; 2); "unknown customer!"))
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.

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

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...