Working with Shared Code

Shared design elements are items that can be created once and used many places within the database. Using shared objects enables you to create and manage resource attributes from a single location. This simplifies application maintenance, reduces the overall code base, and improves application efficiency. Shared code can include agents, Web services, outlines, subforms, fields, columns, actions, and script libraries.

Agents

Agents are standalone programs used to perform a task. They can be called manually or scheduled to run on set intervals. Agents can be configured to perform a simple action from a predefined list of tasks or programmed using Formula Language, LotusScript, Java, or Imported Java code.

Note

See Chapter 9, "Collaborative Applications," Chapter 11, "Workflow Applications," and Chapter 16, "Sample Agents," for example agents and step-by-step setup instructions.

 

Web Services

A Web service is a self-contained application that can be invoked from a Domino Web application. Typical Web services include LotusScript, Java, SOAP, and XML-based services. Web services are invoked much like an agent and support browser-based applications.

Outlines

Outlines provide a means to navigate an application interface. Using outlines, you can create a navigational structure for the entire database application that is maintained from a single location.

Note

See "Create a Custom Application Interface" in Chapter 17, "Miscellaneous Enhancements and Tips for Domino Databases," for step-by-step setup instructions for creating an outline.

 

Subforms

Subforms look and work just like forms with one exception. Subforms can be embedded, or shared, with other forms in the database. For example, let's say you have a Human Resource database that's used to track vacation, leaves of absence, and travel requests. Each form starts with the same six fieldsreference number, first name, last name, employee number, start-date, and end-date. Instead of creating these fields on each of the forms, you could create one subform and embed it into each of the main forms.

Tip

To keep a consistent group of buttonssuch as Edit, Save, and Closeacross multiple forms, create a subform that only contains action buttons. Embed the subform at the top of each form or use shared action buttons. Be sure to give the subform a meaningful name, such as Shared Form Buttons or Common Buttons.

 

Fields

Similar to subforms, shared fields can be defined once and embedded in one or more forms and subforms. The primary benefit of a shared field is to allow the programming behind the field to be shared across multiple design elements.

Columns

A shared column is a column created once and used across multiple views. Changes to the column are automatically applied across all views containing the particular column.

Actions

An action is a self-contained module that performs a task when the user manually clicks a button. Action buttons display either in the action bar (located at the top of the application screen) or in the Action menu. Buttons can also be configured to run an agent. Shared actions provide the ability to maintain programming code from a single location and implement the functionality across the database application.

Script Libraries

Script libraries are used to store a collection of LotusScript, JavaScript, or Java subroutines and functions shared throughout the application. Using a script library, developers can write and maintain code from a single location.

A script library should be created and used anytime you identify reusable code for an application. This simplifies application maintenance (e.g., you only have to modify code in one place), reduces the complexity of the application, and makes the application more efficient.

For example, let's say you have three unique forms, and each form has a Save button that checks to see if the document has a record number (see Figure 4.35). Using a script library, you can maintain a single subroutine that all of the buttons utilize.

Figure 4.35. LotusScript libraries can be used across the database design elements.

Thus, if the code needs to change, you update the source code in one location (as opposed to each of the buttons individually).

Note

In order to utilize a LotusScript library, you must add the statement USE LIBRARY where LIBRARY is the name of the LotusScript library. Add this to the GLOBAL section of each design element (e.g., form, view, agent, etc.).


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