21
Thu, Nov
1 New Articles

What Every Client Access/400 Programmer Needs to Know About Lotus Notes

Collaboration & Messaging
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

For programmers and systems integrators, learning about new programming environments is one of the never-ending joys of the job. Each environment has its own tools, its own quirky interface, and—if you’re successful at figuring it out—its own rewards. Lotus Notes is no exception. Since Notes is rapidly becoming an integrated part of the AS/400 system, understanding how to program in Notes is becoming a topic of concern for many Client Access/400 integrators. Consequently, we’re including this brief tutorial to whet your appetite.

The Components of Lotus Notes

Notes is divided into four major functional components: a document database, forms, views, and agents. The document database contains the usual types of fields available to most databases: numeric fields, character fields, key fields, and special “rich text” fields into which you can embed Object Linking and Embedding (OLE) objects. The document database is created through the use of templates called forms. Forms are the functional equivalent of DDS specifications in OS/400; they define the structure of individual documents as they are created and added to the document database. However, each element and field within a form is fully programmable using the Notes design tools. In a similar manner, a Notes view is akin to an AS/400 logical file; it organizes the logical path into the document database so that documents appear in a desired group. Views are also fully programmable using the Notes design tools. Notes agents are self-contained programs that are pure program scripts. The agent scripting language is an extension of the Basic language, but, unlike traditional QBASIC, Notes Basic is a full object-oriented implementation using object classes. The programming interface of Notes agents is also made available through the Notes design tools. There are other design tools besides forms, views, and agents, but for this discussion, we’ll focus on the major ones. In this article,


I’ll explain the process of programming a Notes form, which will introduce you to the concepts used when programming agents and views.

Accessing the Notes Programming Tools—Working in Forms When a Notes programmer wants to affect the structure of a particular Notes database, he double-clicks on the design frame within the database itself to expand the hierarchy of design tools. He then chooses a particular form to modify. This is shown in Figure 1.

Opening the form displays the structure of the Notes database in a two-paned window. The upper portion of the window shows the layout of the document created by the form. The lower pane is the programming interface that contains the code for controlling the form. The AS/400 equivalent of this interface would be screen design aid (SDA), in which you place fields and constants on the screen and then modify the programmed functionality of those fields using the SDA menus. In the Notes interface, however, both the design screen and the programmed functions of the fields are presented at the same time. This is shown in Figure 2.

To create constant text on a form, you simply key it into the upper pane. To create a new field, you click the menu bar and then click Create Field. A new untitled field is added to the form at the location of your cursor. The lower pane of the interface automatically moves its focus to the newly created field, allowing you to program the “default value” event.

Notes has a complete event-driven user interface that allows you to write formulas and scripts for input translation, input validation, cursor entrance or exit, termination, and more. Each event can contain a trigger, a formula, or a script, just like an RPG subroutine that is triggered when the user hits a command key.

Syntax and Field Properties

There are two types of program syntax that can be activated by a field event: formula syntax or script syntax. First of all, formulas use a macro syntax composed of @Functions keywords. These are highly developed—and extremely powerful—preprogrammed functions that have evolved through Notes’ long development history. The complete list is available by pressing the Fields and Functions button at the bottom of the screen. The second syntax is Lotus Script, the highly developed programming extension of Basic mentioned earlier. Lotus Script is extremely powerful for establishing highly complex program flows, such as retrieving data through ODBC and displaying subwindows. Examples of a Lotus formula and a Lotus script are shown in Figures 3 and 4.

The properties of a field (its name, type, and style, and the security attributes associated with it) are controlled by the Properties box. To access these properties, you double-click the field on the form and a floating tabbed folder is displayed. Learning about the power of field properties is one of the great mysteries that—when revealed—will make you a true believer in the Notes interface.

Working with Keywords—Fast Subfiles at the Click of a Button

Let’s assume you want to create a simple selection list. By changing the field type to keywords, you’re presented with five different types. You can choose Enter Choices (one per line) to force the user to select a constant value; you can choose Use Formula for Choices, which allows you to calculate a variety of selections based upon other fields in the document; you can choose Use Address Dialog for Choices, which will display a subwindow connected to the Notes Address book; you can choose Use Access Control List, which displays a subwindow connected to the Notes Security Access Control List; or—most powerful of all—you can choose Use View Dialog for Choices, which gives you


access to a predefined logical view of the database you’ve created. This last choice is the equivalent to creating a subfile program in RPG and making it available with a click of the button. You can see the properties folder in Figure 5. A sample of how this subfile-like feature works in action is shown in Figure 6. In this example, the user clicks on a selection field called “topic” and a preprogrammed view allows him to choose the appropriate element of the file.

The Notes Debugger

When you’ve finished creating, programming, modifying, or tailoring the fields of the form, it’s time to test them. Notes has some solid debugging tools built right into the programming interface. To activate the debugger, you select Tools from the File menu, then choose the Debug Lotus Script option. Then, you select Design and click Test Form. Notes asks you if you want to save the form, and—if you say yes—it compiles it and activates it to create a new Notes document. The Debugger window pops up and walks you through the flow of the document creation process, showing you each step. This is shown in Figure 7. You can set breakpoints, show the values of individual fields and variables, or change the flow of the program on the fly. It even allows you to control the processing of subforms that may be embedded with a master form. All told, it’s an extremely powerful tool.

Accessing the Power of Notes and Beyond

This is only a very brief overview of the power of the Notes programming interface. In fact, it’s only a beginning of learning something that will soon become an integrated part of your AS/400 client environment. How does Notes work with the AS/400? In the next issue of Client Access/400 Expert, Timothy Laurent, a leading AS/400 Notes programmer, will show you exactly how this interface can be used to access data on the AS/400.

Figure 1: Altering the Notes Database Structure Using the Design Frame


What_Every_Client_Access-_400_Programmer_Needs...03-00.jpg 450x229

What_Every_Client_Access-_400_Programmer_Needs...04-00.jpg 600x372

Figure 2: The Notes Programming Interface Figure 3: A Sample Notes Formula Using @Functions


What_Every_Client_Access-_400_Programmer_Needs...04-01.jpg 450x270

What_Every_Client_Access-_400_Programmer_Needs...05-00.jpg 450x251

Figure 4: A Sample Notes Script Using Lotus Script Figure 5: Notes Field Properties Box


What_Every_Client_Access-_400_Programmer_Needs...05-01.jpg 600x487

What_Every_Client_Access-_400_Programmer_Needs...06-00.jpg 450x276

Figure 6: View Dialog Processing Figure 7: Notes Debugger in Action


What_Every_Client_Access-_400_Programmer_Needs...06-01.jpg 450x337

Thomas Stockwell

Thomas M. Stockwell is an independent IT analyst and writer. He is the former Editor in Chief of MC Press Online and Midrange Computing magazine and has over 20 years of experience as a programmer, systems engineer, IT director, industry analyst, author, speaker, consultant, and editor.  

 

Tom works from his home in the Napa Valley in California. He can be reached at ITincendiary.com.

 

 

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: