Email:   


Home
In This Issue
Email a Friend
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.


Add random quotes and signatures to your Notes mail messages (continued)

Given the three design features listed above, we can accomplish our goals with one external database and by modifying a single field on the Memo form of my mail database. Let's build the database to hold the quotations first, and then modify the Memo form later.

Where do the quotes come from?
Our quotation database is one that I'm going to call "Quote-ster". Quote-ster consists of one form to hold the quotes and one view to be used for sorting, viewing, and retrieving that information. To make your own quote database, create a new empty database called QUOTESTER.NSF, then create a new form with a name of "quote". That form only needs two fields: Text and Number. Text is a text field (single value) with no default value. Be sure to make it text so that it can appear in views. Number should have the field type Number. This numeric field is part of what we'll use to randomize the quote from email to email. In order to be sure that our quote numbers are sequential, we'll give this field the default value shown below:

Col := @DbColumn( "":"NoCache" ; @DbName ; "Docs" ; 1 ) ;
Count := @Elements( Col ) ;
@Subset( @Subset( col ; Count ) ; -1) + 1

Because the Quote-ster database isn't going to be interacted with directly all that often, we're not going to spend a lot of time adding tons of views to it. There really only needs to be one view in the database. Looking at the formula above, you can probably tell that the name for the view needs to be "Docs".

Create this view within your copy of the database and set the first column to be sorted in ascending order with the Number field as its contents. The next column should be a column to hold the text of the quote so naturally its value will be retrieved from the Text field from the quote form. If you'd like, you can also make the text field a sortable column when it's clicked on. If you look at Figure B, you can see that once you've gotten the form and view built, you can begin to populate the database with quotes that you enjoy.

FIGURE B

A completed Quote-ster database that's had some quotes added might look like this. Click picture for a larger image.

That's it for the quote database. Now all that you'll have to do is modify the Body field of your mail Memo form to put the new information at the bottom.

Modifying your mail file
What makes the automatic quote and contact information possible is the default value formula of the Body field in your mail database Memo form. Rich Text fields can have default value formulas and we'll use that functionality to generate a random number and select a quote from our database based on that number.

The new default value formula for our modified Body field is shown below. I'll describe what each of the six lines does after the code listing.

QuoteList := @DbColumn( "Notes":"NoCache" ; "":"quotester.nsf" ; "Docs" ; 1 ) ;
Top := 1 ;
Bottom := @Elements( QuoteList ) ;
WhichOne := @Round( ( Top - Bottom )* @Random + Bottom ) ;
Quote := @DbLookup( "Notes":"NoCache" ; "":"quotester.nsf" ; "Docs" ; WhichOne ; 2 ) ;
@NewLine + @NewLine + "Richard Echeandia" + @NewLine + "Voice: 214.555.1212" + @NewLine +"Mobile: 214.555.0000" +@NewLine +"email: recheandia@dominopower.com" + @Trim(@Text( @NewLine + @NewLine + "--- \'Quote-ster \' Quotation # " + @Text( WhichOne ) +" " + @Repeat("-" ; 20 ) + @NewLine + Quote ))




[ Prev | Next ]

-- Advertisement --

Learn Notes and Domino 7 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away. WebSphere courses are also available!

Click here to try a FREE demo course!!

-- Advertisement --

Webcast: IBM Lotus Notes/Microsoft SharePoint Co-Existence Strategy
  • Deliver easy access to SharePoint document libraries from Notes;
  • Build business mash-ups across SharePoint data, Domino, Java and .NET applications;
  • Implement a cross-platform enterprise content management strategy and store Notes emails on SharePoint sites
...without having to invest in high-cost migrations.


Register for the July 15th Webcast!
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.