Search DominoPower's 10,675 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 (95 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
   Troubleshooting an OpenSuse Notes install
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
What to look for in a Domino-based document management solution
Understanding Domino.doc end-of-life options
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
Top 10 ways to launch and build a Lotus consulting practice (with a little help from the Beatles)
Troubleshooting an OpenSuse Notes install
Incident report: denial of service attack against ConnectedPhotographer.com
Latest Lotus Headlines
SnTT - Enabling ALL the bells and whistles!
Tivoli Data protection causes Domino to crash
Fun when running DB2 CLP scripts
Introducing Flippr, the easy way to admin Quickr
DXL and fake security
Using search forms in IBM Workplace Collaborative Learning 2.7
Schmidt, Freed, and Gering on the OVF Toolkit
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Eight steps to successful and reliable home backups
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Can Outlook run when it's not running (and other mysteries)?
-- Advertisement --

PistolStar: Lotus Notes Authentication That Breaks the Status Quo
Password Power's complete integration with the Microsoft Active Directory password enables Notes client access, ends time-consuming Notes ID password recovery and addresses known issues with Notes 8.5:
  • Passwords are encrypted in volatile memory - not stored on user's hard drive
  • Notes roaming capabilities are fully functional - not limited
  • Password checking is honored - no decreased security or failed compliance
  • All Notes ID file copies are synched automatically with Active Directory password - no remembering old passwords or restoring ID files


Learn more about Password Power's powerful, advanced functionality.
-- Advertisement --

Easy Domino Access: Remove Passwords, End Login Prompts, Reduce Password Management
PistolStar's Password Power provides browser-based single sign-on to Lotus Domino, Sametime and Quickr with the enhanced security of the Kerberos or NTLM authentication protocol.

  • Full support available for NTLM authentication protocol in non-Active Directory environments
  • Seamlessly integrate Microsoft Active Directory and the Kerberos authentication protocol
  • Leverage Active Directory password policies to unify Lotus applications


Learn more about Password Power's powerful, advanced functionality.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2009, ZATZ Publishing. All rights reserved worldwide.
Editor's Login