Real-World LotusScript Examples

By Deborah Penny

IN THIS CHAPTER

  • Real-World Example 1: Importing a Delimited Text File
  • Real-World Example 2: Delete a Parent Document and All Its Children: DeleteParentAndChildren
  • Real-World Example 3: Schedule an Agent Robot to Refresh All the Documents in a View: Robot-DailyRefreshAllDocs
  • Real-World Example 4: Return a Web User to the Place Where He Started After a Document Is Submitted: WebQuerySave-DocSubmit

The release of Domino 6 brings several new rich features and enhancements to the script functions and @Functions that are long overdue. LotusScript is not always the best use of a developer's time: It can appear to be intimidating and a lot of extra work. Nevertheless, @Functions' capabilities pale in comparison to those of LotusScript, which touts heavy-duty processing power versus the simple functions of @Functions. Domino 6 does bring new @For , @While , and @DoWhile macro language functions, which were not included in previous versions and forced developers into using LotusScript for automated routines. Generally, however, LotusScript should be used when simple functions cannot. Use LotusScript when automating complex routines, performing iterative operations, or handling transactions.

This chapter provides you with several real-world LotusScript routines that will help you dive right in if you're not familiar with the language. At the very least, it will provide you with some good working solutions that you might or might not already have in your own code repertoire .

Just remember that there are many ways in which to approach scripting with LotusScript, just as many as there are ways to develop a solution to a problem in Domino. You might have a different style or set of rules that you approach and apply to scripting with LotusScript. Don't think that one way is the only way. The best advice anyone can give you is to keep your script simple: Someone might have to come after you and support it. Provide comments in your code: Someone might have to come after you and rewrite it. And keep it organized: Someone might have to come after you and add functionality to the routines. There is no worse headache than having to re-engineer someone else's mess!

NOTE

Each of the scripts used throughout this chapter will be separated into code blocks, and each block's description and purpose will be discussed in turn . At the end of each script discussion, the script is shown in its entirety. These examples also assume that you have some basic knowledge of LotusScript, know how to program it in the IDE, and are familiar with its back-end and front-end classes.

 

The first example shows you how to import an attached file containing delimited records in a text file directly into a Domino database as a new document. The second script provides an easy example of how you can delete a parent document, along with any of its associated, linked, or response documents. The third script example shows an easy way to refresh all the documents in a database or a specific subset of a document in a database. This script is useful if you are working with workflow routines or event-driven applications. The fourth example uses session cookies, LotusScript, @Functions, and JavaScript together to navigate the user back to a starting URL location on the Web.

Overall, each of these scripts shows you how to perform real-world tasks using LotusScript and proven methods . Each contains useful routines and subroutines that can be used repeatedly and make your applications even more powerful at the same time.

Part I. Introduction to Release 6

Whats New in Release 6?

The Release 6 Object Store

The Integrated Development Environment

Part II. Foundations of Application Design

Forms Design

Advanced Form Design

Designing Views

Using Shared Resources in Domino Applications

Using the Page Designer

Creating Outlines

Adding Framesets to Domino Applications

Automating Your Application with Agents

Part III. Programming Domino Applications

Using the Formula Language

Real-World Examples Using the Formula Language

Writing LotusScript for Domino Applications

Real-World LotusScript Examples

Writing JavaScript for Domino Applications

Real-World JavaScript Examples

Writing Java for Domino Applications

Real-World Java Examples

Enhancing Domino Applications for the Web

Part IV. Advanced Design Topics

Accessing Data with XML

Accessing Data with DECS and DCRs

Security and Domino Applications

Creating Workflow Applications

Analyzing Domino Applications

Part V. Appendices

Appendix A. HTML Reference

Appendix B. Domino URL Reference



Lotus Notes and Domino 6 Development
Lotus Notes and Domino 6 Development (2nd Edition)
ISBN: 0672325020
EAN: 2147483647
Year: 2005
Pages: 288

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