Advanced LotusScript for Notes and Domino 9
Units: 12
Duration: 3 classroom equivalent days
Discussion Access: 12 months

Summary Description
Take your LotusScript skills to the next level with TLCC's Advanced LotusScript for Notes Domino 9 course. Learn how to use subroutines, functions, and script libraries to reuse your code and build a library of commonly used routines. Build error-handling into your LotusScript code to effectively trap and handle run-time errors. Discover how to more effectively work with agents by using Notes logs to record agent activity and error messages. Control your agents more effectively by understanding agent security and agent triggers. Learn how to integrate relational database information into your application. Use the LotusScript Data Object classes (LS:DO) to read and write data that resides in a relational database via ODBC. Next, use the LC LSX to read and write enterprise data via Lotus Connectors. Learn advanced techniques to program Rich Text fields and dynamically create tables, doclinks, and sections. Discover how to create a great looking internet email from a LotusScript agent using the MIME and NotesStream LotusScript classes.

Audience and Prerequisites
The recommended prerequisites are:
  • TLCC's Beginner LotusScript for Notes Domino 9 course
  • TLCC's Intermediate LotusScript for Notes Domino 9 course
System Requirements
A single Notes 9 and Domino Designer 9 client. Access to the Internet is required to get instructor support.

Course Modules

Module 1 - Streamlining Code with Procedures
A procedure (or sub-program) is a collection of instructions grouped together to perform a specific task. This module explains the need for procedures in LotusScript and describes how to define and use procedures in your Notes applications.
  • Understand the need for procedures in Notes applications and the advantages of using them
  • Be able to identify the types of procedures in LotusScript
  • Learn how to divide a program into procedures
  • Recognize a subroutine and its components
  • Learn how to create and use a subroutine
  • Recognize a function and its components
  • Learn how to create and use a function
  • Understand the concept of scope and be able to identify the scope of a variable or procedure
  • Understand the difference between passing arguments "by value" and "by reference"
  • List and demonstrate the variable values that a procedure can manipulate
  • Understand the issues that can arise when a procedure manipulates nonlocal variables
  • Learn how to locate, create, and use Script Libraries
  • Learn how to call Java classes from LotusScript using the LS2J LotusScript Extension
  • Learn how to use the Evaluate Function to call @functions
  • Learn how to create custom classes to represent an object

Module 2 - Handling Run-Time Errors
If Notes encounters an error while running LotusScript code, it immediately stops execution and displays an error message to the user. It is good programming practice to anticipate where errors may occur and to provide a graceful way of handling them. This module describes how to intercept LotusScript run-time errors and handle them gracefully.
  • Understand the situations in which errors are most likely to occur
  • Learn how to use an If statement to test for an error condition
  • Learn where to find the list of LotusScript error codes
  • Learn how to intercept a run-time error
  • Learn how to develop a routine to handle errors and make it available to your scripts
  • Learn how to determine the line of LotusScript code that was executing when an error occurred
  • Learn how to retrieve a descriptive string that describes the error
  • Be able to provide multiple error-handler routines
  • Define and use your own error codes
  • Learn to direct Notes to use an error-handler routine in another procedure
  • Learn how to use the Remote Debugger tool to debug a LotusScript agent running on the server
  • Learn how Agent Profiling can be used to fine tune agents and web services

Module 3 - Creating and Maintaining a Log
One of the best ways to monitor agent activities and errors is to record them in a log. With LotusScript, you can create several different types of logs and you have complete control of what gets posted in them. This capability is extremely useful in documenting the changes an agent makes to Notes data and can be an excellent debugging tool.
  • Understand the need for agent logging in Notes and Domino applications
  • Understand the types of logs that LotusScript supports
  • Learn how to create and use a Notes log database
  • Learn how to create a log
  • Understand the kind of information that you can post in a log
  • Learn the steps required to post information to a log
  • Know how to track the number of additions that your code makes to a log
  • Be able to turn logging on and off
  • Learn how to determine the name of the current agent
  • Know how to determine who is the agent owner
  • Understand the importance of the agent owner
  • Learn how to trigger an agent to run immediately
  • Learn how to control when and where an agent runs

Module 4 - Working with ODBC Data Sources
Many organizations maintain at least some of their data in legacy systems that involve traditional relational databases. Most relational databases conform to an industry standard called the Open Database Connectivity (ODBC) standard. ODBC enables two diverse database systems to communicate with each other. Domino supports the ODBC standard and provides both formula language calls and LotusScript classes that you can use to access and update data in non-Notes databases.
  • Understand the basic structure of a standard relational database
  • Understand the requirements for using ODBC
  • Learn how to install ODBC drivers on your Windows system
  • Learn how to register the ODBC databases that you want to access via Notes
  • Understand what the LotusScript Data Object LSX module is and know how to load it
  • Be able to name the three object classes that comprise the LotusScript data object module
  • Know how to establish a connection to an ODBC data source
  • Know how to determine what the ODBC data source looks like
  • Be able to formulate an SQL query that specifies the data you want to access from the data source
  • Know how to provide interactive queries that let the user specify the data to access
  • Be able to retrieve the data from the ODBC data source into a result set
  • Be able to navigate the result set
  • Be able to copy data from the result set into Notes documents
  • Know how to write changes to existing data that are made in Notes back to the data source
  • Know how to add new information to a data source via Notes
  • Learn how to incorporate error handling capabilities into scripts that access non-Notes data

Module 5 - Using Lotus Connectors
DCRs, DECS and LEI use a technology called Lotus Connectors to interface with a back-end enterprise data source. Lotus Connectors are written using the native database's API to provide high performance. Lotus Connectors can be accessed via a set of APIs available through a LotusScript eXtension (LSX). This Lotus Connector LSX (LC LSX) allows the programmer to use high performance drivers to access any data source for which a connector is available such as DB2, Oracle, and Sybase. This module will teach you to use the LC LSX to read and write data using the Lotus Connectors technology.
  • Review the different enterprise data connection interfaces and understand how they use Lotus Connectors to interface with a back-end data source
  • Use the LC LSX to connect to a data source
  • Use the LC LSX to read data from a data source
  • Selectively retrieve data using the Selection keys
  • Update a record using either the Writeback or Keyed Update methods
  • Transfer data between two data sources using two Lotus Connectors

Module 6 - Advanced Techniques for Rich Text Fields
In this module you will learn advanced techniques for handling Rich Text fields. Objects such as doclinks, sections, and tables can be created and modified by simple coding. These techniques are specially useful for dynamic reporting and attractive presentations of the information.
  • Use the NotesRichTextNavigator class to navigate and work with rich text elements
  • Use the NotesRichTextRange class to work with a range of rich text
  • Use the NotesRichTextDocLink class to create, change, and remove doclinks and hotspots
  • Use the NotesRichTextSection class to create and remove sections
  • Use the NotesRichTextTable class to create, change and remove tables
  • Dynamically change the contents of a table cell
  • Use the NotesStream class to read and write data to and from the file system
  • Use the Notes MIME classes to create a formatted internet email via LotusScript

Module 7 - Additional Topics
This module covers some miscellaneous LotusScript topics.
  • Use the IsResponse property and MakeResponse method of the NotesDocument class
  • Import a CSV File using LotusScript
  • Use the NotesDbDirectoryAccess class to access all databases on a Notes client or Domino server
  • Read, change, add or delete entries in the Access Control List (ACL) of a database
  • Use the three Calendar classes introduced in Domino 9 to create a new calendar entry, read the calendar entry data and decline a meeting invitation
  • Use methods of the NotesSession class to read and write environment (NOTES.INI) variables
  • Work with the AddressBooks property of NotesSession class to access all the configured Domino Directories on the computer
  • Use the DXLExporter class to export Domino XML (DXL) data