How to Inherit Fields Between Forms

Using the "Inherit" feature, field values in one document automatically transfer to and populate fields on another document. This feature is typically implemented in conjunction with custom dialog windows and "response" and "response to response" documents.

For example, lets say that you are building a database to manage service requests. The database includes two formsone to track the customers request and another to track the cost estimate. When building the database, you would like three fields from the "request" to automatically populate the related fields on the "estimate". The three fields are

  • RequestTitle
  • RequestNumber
  • RequestAuthor

Using the Inherit property, these fields transfer to the new form when created. This saves the user some time by avoiding the need to manually create the new "estimate," and it ensures that related information is accurate.

How It Works

This feature works by transferring data between two fields (see Figure 17.6). Both forms must have the exact same fields, and the Inherit property must be set on the secondary form (i.e., the "estimate" document). In many cases, youll want to set the fields on the secondary form to be computed to prevent users from changing the values.

Figure 17.6. Field inheritance between forms


After the forms have been designed, a button to generate the secondary form should be added to the primary form. For example, a button called Create Estimate would reside on the service request form. When the user clicks this button, a new "estimate" document would be created (using the compose command), and field values would be transferred to the new document.

Implementation

To implement this technique, complete the following steps.

Step 1.

Create a primary and secondary form. After the primary form and associated fields have been established, create the fields on the secondary form.

Step 2.

In order for the inherit function to work, one or more field names on the secondary form must match the field names on the primary form exactly (or fields on the second form must contain formulas that reference fields on the primary form). As an alternative to creating new fields, you could also copy all fields from the primary form to the secondary form. Optionally, you could change the fields to Computed to prevent the field values from being changed. If you make the fields computed, set the formula to the field name.

Step 3.

To enable the inherit feature, select the Design > Form Properties menu option on the secondary form. Switch to the second tab and select the Formulas inherit values from selected document option (see Figure 17.7).

Figure 17.7. Setting the field inheritance property for a form


Step 4.

The final step is to create an action button on the primary form. The action button will compose a new document and should reference the "secondary" form. The following illustrates how to create an action button using Formula Language; however, LotusScript could also be utilized.

@Command([Compose]; "FORM")




An Introduction to the Lotus Domino Tool Suite

Getting Started with Designer

Navigating the Domino Designer Workspace

Domino Design Elements

An Introduction to Formula Language

An Introduction to LotusScript

Fundamentals of a Notes Application

Calendar Applications

Collaborative Applications

Reference Library Applications

Workflow Applications

Web Applications

Design Enhancements Using LotusScript

Design Enhancements Using Formula Language

View Enhancements

Sample Agents

Miscellaneous Enhancements and Tips for Domino Databases

Data Management

Security

Application Deployment and Maintenance

Troubleshooting

Appendix A. Online Project Files and Sample Applications

Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?



Lotus Notes Developer's Toolbox(c) Tips for Rapid and Successful Deployment
Lotus Notes Developers Toolbox: Tips for Rapid and Successful Deployment
ISBN: 0132214482
EAN: 2147483647
Year: N/A
Pages: 293
Authors: Mark Elliott

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net