Search DominoPower's 11,323 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
PROGRAMMING POWER
Tips and tricks in LotusScript
By Mick Moignard

Long before I was a Lotus Notes geek, I was employed as a mainframe programmer. I wrote applications in PL/I (Programming Language One), which ran on IBM's MVS (Multiple Virtual System) and used database systems like IMS (Infrastructure Managed Services) and DB2. In fact that's where I learned the art of programming, and most of what I learned then about how to go about writing programs is still valid when writing LotusScript code for Notes now. There are, for sure, some differences. The object oriented access to Notes is different, and the data types are certainly somewhat different. So I thought that in this article I'd present a small collection of LotusScript programming tips and tricks I've worked out and remembered over the last couple of years and compare them to "the good old days."

Array lookups
Arrays are some of the most useful things in any programming language for keeping track of lookup values, conversions of coded data to human-readable values for presentations, and so on. Notes, unlike many database systems, actually makes use of this with the concept of multivalue fields. I know it calls them lists, but what is stored is actually an array.

One application I did a year or two back was designed to collect, in a Notes database, the error reports that came from printers around the organization so that we could do an analysis of the different sorts of errors and exceptions that occurred. The printer messages contained the printer name and a code that indicated what the problem was. In my application I had a couple of profile documents, one that held a table of printers and their physical location data, and the other which had a three column table that translated the error code both to text and to a severity code. These tables were actually implemented as multivalue text fields, and as they were static data maintained by an administrator, I felt that the only validation necessary was to ensure that the multivalue fields on each document had the same number of entries.

Back in the past, to look up items in an array, the usual method was to loop around the array with PL/1's equivalent of a for/next loop until we found a value that matched, or if the array was big, to do a binary search on it. It wasn't difficult code, but it had to be typed and tested every time. LotusScript makes doing this completely redundant with the ArrayGetIndex function, which does all that for you. Consider this code fragment:

index = Arraygetindex(Printerprofdoc.printer_name, doc.subject(0))
If Isnull(index) Then
doc.location = "Not in profile"
doc.printer_site = "Not in profile"
Else
doc.location = Printerprofdoc.printer_location(index)
doc.printer_site = Printerprofdoc.printer_site(index)
End If


1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Home > Tips & Techniques (102 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   A faster way to repair corrupted server files
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Five trends for 2010
DominoPower TV Episode 1: Inside a strategy session with Teamstudio
More about Domino log files
Say goodbye to the Uh-Ohs. Long live the Tens.
Why your log.nsf might not be purging properly
Latest Lotus Headlines
Recommended Maintenance - Lotus Notes Traveler
Here are the slides and other materials from our Lotusphere session
Microsoft OCS awareness in Lotus Connections and Websphere Portal?
SnTT: XPages Blank Calendar Control (Part 2), adding data
Have your Lotus Notes calendar display multiple time zones
Sample Database for Microsoft Office and Lotus Symphony Integration
Symphony 3.0 beta signals another attack on Office
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad: Apple's latest heartbreaker
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Running auto-respond rules when Outlook is closed
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


Learn more at www.integra4notes.com.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login