Lotus Lessons Learned

This is a guest blog entry by Tanya Delaney.


Recently, I had the honor of meeting and working with Karl-Henry Martinsson. I am a Lotus Notes ?ewbie,´ though I have a technical and web-based background. The last time I used Notes was as an end user (limited to checking email) while an employee of IBM in 1993. When Karl introduced himself as a Lotus Notes programmer and developer, I said to him, "People still use Lotus Notes?" The rest, as they say, is history; Karl has been on a mission to educate me ever since.

I am a web designer and developer, most fluent in ActionScript as well as the web standards HTML, CSS, some PHP, and I dabble in a bit of whatever is needed depending on my clients´ particular situations. As far as databases go, I always use MySQL. For this reason, Karl has been singing the praises of Lotus Notes and Domino ?though his accolades have fallen on my deaf ears. I was under the [incorrect] impression that Lotus Notes was only good for email, much in the way MS Outlook is, and I had no use for either.


Karl gave me a crash course in Lotus Notes as well as LotusScript to show me how efficient Lotus could be. As an example, he created a simple database in mere moments to hold ?ecipe´ data as well as titles, authors, and even country of origin information. He not only put it together (and made it look nice), but also challenged me to write a similar web ready database in as much time. “…”Right. I already knew matching both the power of Notes as well as his programming skill was impossible. So Karl amended his challenge: in ten times the amount of time, write a similar web page utilizing a database with all the same information. What took Karl 5 minutes, I now had 50 minutes to create?


I knew how to solve the problem. I could recreate Karl´s steps in my own native tools, but pulling it off without Lotus Notes was going to be a feat. Even without knowing much about Lotus Notes, I knew I was bested. However, I had a MySQL database at my disposal and a bet to try to win.

Since our challenge included a web ready version of the database to write to and read from, I started with a simple form:

//calling our PHP script and setting up the form
<form action="process.php" method="post">
//All the different labels required for this challenge
Country: <input type="text" name="country"><br>
Author: <input type="text" name = "author"><br>
Recipe Name: <input type="text" name = "recipename"><br>
Type of Recipe: <input type="text" name = "type"><br>
//Accolades to the low carb community
Is it Low Carb?: <input type="text" name = "lc"><br>
<input type="submit" value="Submit">

Here is a screen shot of a basic, simple form created for this challenge.


Since I decided to interact with a MySQL database, I decided to use PHP to interact with it. This form calls for a PHP file called process.php (in line 1), a file I had to create. The rest is pretty simple ?the form calls for different fields and once the user clicks on submit, all their values will be passed to the SQL database.

Process.PHP is the entire reason this form works. That being said, let´s take a look at what´s there:

//calling our database categories
//database u/p information
mysql_connect("localhost", "some_user_name", "some_password") or die(mysql_error());
//database and table information
mysql_select_db("karls-challenge") or die(mysql_error());
mysql_query("INSERT INTO `karl` VALUES (‘$country’, ‘$author’, ‘$recipename’, ‘$type’, ‘$lc’)");
//letting us know that everything went well
Print "Your information has been successfully added to the database.";

The above script is basically listing all the values that our database has for this particular challenge, as well as login information to the database. After authentication, all the values are passed to the database. However, part of the challenge was to also retrieve this information, so, yet another PHP file needed to be created.

// Connect to the database server
mysql_connect("localhost", "some_user_name", "some_password") or die(mysql_error());
// Open to the database
mysql_select_db("karls-challenge") or die(mysql_error());
// Select all records from the "karl" table
$result = mysql_query("SELECT * FROM karl")or die(mysql_error());
// Loop thru each record (using the PHP $row variable), then
//display the fields "country, author, recipename, type, lc" of each record.
while($row = mysql_fetch_array($result)){
echo $row[‘country’]. " – ". $row[‘author’]. " – ". $row[‘recipename’]. " – ". $row[‘type’]. " – ". $row[‘lc’];
echo "<br />";

The script above queries the database and will keep looping until it receives all the data. It will be displayed on a website in plain text. This, however, is only 1 view of the information.


Lotus Notes definitely wins here ?I ran out of time before I could even begin to attempt different views. Even if I had more time, it would take a bit of scripting to change the order of data ?something Lotus Notes does very well.

More and more throughout this process, I was really starting to appreciate the power of Notes compared to the tools I currently use. Karl was truly teaching me a lesson I will soon not forget (nor will I ever utter a comment like ?otes? People still use that?´)

Thank you, Karl, for giving me such an eye opener about the power of Lotus Notes and Domino. You´ve definitely made a believer out of me. It was truly an eye-opener to sit down with a Lotus master and observe the simplicity and power of a stellar product that Lotus Notes is.

Bleed Yellow!



Comments by Karl-Henry:

Now I will describe what I did in Notes.

First I created a form called ?ecipe´ with a few fields:


The only code are the formulas behind the three action buttons:

?lose´ button: @Command([FileCloseWindow])

?dit´ button: @Command([EditDocument])

?ave´ button: @Command([FileSave])

The recipe types (appetizer, main course, desert and other) are hard-coded, but could of course be pulled from a profile document or be built some other way.

I also added field hints, so the user can tell what to enter in the different fields.

I then created a view, with the view selection SELECT Form="Recipe".

I added a ?ew´ button, with the following code: @Command([Compose];"Recipe")

There are four columns in the view:

1 : Categorized, displaying the value of the field ?ype´.

2 : Name

3 : Origin

4 : Computed, display value as icons: @If(LowCarb="";"bullet_red.gif";"bullet_green.gif")

That´s all. A total of five lines of code, put together in about 5-6 minutes.

And here is the result:




Note: I used my generic Notes Application template for this, so that saved me a minute or two and gave me a nice look, but the total design time when I showed Tanya this the first time, without that template, was about 5-6 minutes, including actually explaining everything I did. In the original challenge I alsecreated two copies of the view, categorized/sorted on different fields (‘by Origin’ and ‘by Author’) to show the power of views.


Leave a Reply