Thursday, December 27, 2007

SnTT: Using @Abstract To Enhance A View

Have you ever wanted to spice up a view a little by adding abstract information to it? That is, to include some of the text of the document in the view itself so the user doesn't have to open it to determine if it is worth reading? This is pretty simple to do using the @Abstract formula.

@Abstract allows you to abbreviate the content of a field in a Notes document. What I find cool is that it can also work on Rich Text fields. Now, @Abstract is very powerful and can allow you to do some interesting transformations with information in a field, but for the purposes of exposing some abstract information in a view, we'll just use the simple stuff.

In order to maintain good performance in your application, you shouldn't use @Abstract in the view itself. Instead, create a new field on the form in question in order to capture the abstract information. You can then refer to this field in the view column. Let's say you want to add this functionality to a document library. Open the 'Document' form and add a new field called "BodyAbstract". This should be a computed text field. The formula for this field would be something like:

@Abstract( [TextOnly]:[TrimWhite]; 1000 ; "" ; "Body" ).

As used here, this will capture the text of the "Body" rt field, trimming out whitespace and grabbing the first 1000 characters (Check out the help file to see how you can enhance @Abstract with additional keyword parameters).

In the view, in order to allow the user to decide whether or not the abstract should be visible for a particular document, I made the "Subject" column categorized, then included the abstract in a regular column. Here's what it looks like in design mode:

And here it is in action:

Click to enlarge

@Abstract is useful for many purposes, and this simple technique exposes just one of those. I think this idea makes sense for a lot of document-based repositories and as a bonus is really easy to implement.

Sunday, December 23, 2007

Check Out Lotus Note-ables!

Hi all...Hope you're all enjoying the holidays!

I frequently think of or run across Lotus related things that I'd like to post here, but I tend to hesitate, as I'd really like to keep Interface | Matters focused squarely on a specific topic. Since I'm also often toying with different technologies, I setup a new blog to capture these random thoughts. So, if you want yet another site to add to your RSS reader, head on over to Lotus Note-ables and check it out. :-)

I'll be including little snippets about Lotus Notes, and other Lotus products such as Quickr, Connections, Forms, etc. Sometimes I might include a little code (such as the pseudo-code formula language test post I made today).

The site is hosted on Tumblr, which is more like a micro-blogging site. Thus, there are no comments or fancy gadgets to get in the way...just a method for me to drop in quick thoughts. Hope to see you there.

Friday, December 21, 2007

SnTT: A Simple Notes Based Document Rating Idea

Today, I wanted to whip up a simple document rating system that could be used in the Notes client. We see these all the time on the web. Netflix, a site I use regularly, has a nice implementation, as do many others. Jake showed us a nice version using Domino just recently too. I wanted to come up with a pure Notes solution, so I decided to make use of the editable view column property to accomplish this and it turns out it is very easy. I'll refer you back to this post, where I first discussed the concept of using an editable view column to perform an action. Before I review the specifics of the implementation, here's a quick movie to see how it works.

Click for animated demo

This is just a first pass, but I can see that this could be very handy. Basically all that is happening is that we are checking which star (column) is being clicked in the InViewEdit event. Then, we're equating this column to a value, which we add on to the total votes count to date divided by the number of votes. Then, in the final step of the InViewEdit code, we write the new rating value back to the document. I even added a simple check to make sure the user doesn't vote more than once.

Let's break it down step by step:

Step 1: Add columns to your view. I created a separate column for each star, since I want to know explicitly which one was clicked. Set the column to be editable and set it to "Display values as icons".

Step 2: The column value checks the current rating and based on the position of the column determines if it should show the filled or unfilled star.

@If(num_Rating >= 1; "star_red"; "star_open")

Step 3: Add the code to the InViewEdit event. I've included a bunch of comments so you can see what I was going for

Sub Inviewedit(Source As Notesuiview, Requesttype As Integer, Colprogname As Variant, Columnvalue As Variant, Continue As Variant)

Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim caret As String

'Get the CaretNoteID - exit if it does not point at a document
caret = Source.CaretNoteID
If caret = "0" Then Exit Sub

'Get the current database and document
Set db = Source.View.Parent
Set doc = db.GetDocumentByID(caret)

'Check if user already voted by looking if the user's name is in the nam_UsersRated field
'This is just one possible approach. Not sure how this will scale...might want to create a
'new doc in the backend that just records the user's vote for this doc. Have to explore...
Dim alreadyRated As NotesItem
Dim check As Variant
Dim currentUser As String

currentUser = session.UserName
check = Evaluate ( |@IsMember("| & currentUser & |" ; nam_UsersRated)| , doc )
If check(0) = 1 Then
Messagebox "'ve already voted for this document"
Exit Sub
End If

'If we got this far, the user hasn't voted yet, so we'll take their entry
Dim numRatings As Double '# of users who have rated doc
Dim voteTotal As Double 'numeric total of votes
Dim newRating As Integer 'the new rating for the doc (1 to 5)

numRatings = doc.num_NumberOfRatings(0) + 1
voteTotal = doc.num_VoteTotal(0)

Select Case Colprogname(0)
Case "Star1"
voteTotal = voteTotal + 1
Case "Star2"
voteTotal = voteTotal + 2
Case "Star3"
voteTotal = voteTotal + 3
Case "Star4"
voteTotal = voteTotal + 4
Case "Star5"
voteTotal = voteTotal + 5
End Select

newRating = Round((voteTotal / numRatings), 1)

doc.num_Rating = newRating
doc.num_VoteTotal = voteTotal
doc.num_NumberOfRatings = numRatings

'Add the user's name to the list of people that voted
Set item = doc.GetFirstItem( "nam_UsersRated" )
Call item.AppendToTextList( session.UserName )

Call doc.Save(True, False, True)

End Sub

This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at


Of course, before you implement something like this, you need to think through the implications of it in a production database. Do all users have the ability to edit documents? If not, perhaps you could use stub documents instead. Also, do you want to give the users the ability to see their vote vs. the actual vote? All of these things can be done...this is just the tip of the iceberg.

While this is really rough and I can think of several enhancements to be made, please feel free to download the sample database if you want to play around with it. If you actually use this technique or enhance it, please let me know...I'd be interested to see it.

Have a great holiday everyone!

Thursday, December 20, 2007

Quick Tip: Add To Folder...

Well...this is short and sweet! :-)

Recently, I was surprised to find several people that did not know this little tidbit, so I thought I'd share. Plus, it's a nice addition to my last post about drag and drop in case you use a folder for the target.

If you want to add a Lotus Notes document to a folder while keeping it in the current folder, just press the "Ctrl" key while you do so. Just like in Windows Explorer, you'll notice that the cursor changes slightly to denote that you are "copying" the document to the new folder rather than just moving it.

Like I said...short and sweet [insert obligatory short Notes developer/admin joke here...there's a bunch to choose from! ;-D ]

Sunday, December 16, 2007

Quote of the Day

From my daughter Haleigh (she's 9 and autistic) in reply to her brother who asked if we had any Canadian Bacon:

"Do we have to go to Canada to kill a pig to get Canadian Bacon?"

Made us laugh...

Friday, December 14, 2007

Want to work with me?

Well...not directly with me, but on the same team (which I guess sometimes could mean directly with me).

Anyway, if you're keen to join me in the wonderful world of technical sales for Lotus Software *AND* you live in either Columbus, Cleveland or Pittsburgh *AND* you have strong Portal skills, then we want to talk to you! :-)

Here's the gist of the job:

Responsible for technical product/solution presentations and demonstrations of IBM's Messaging, Portal and Collaboration solutions, conducting Proof of Concepts and Proof of Technology workshops, responding to RFIs/RFPs, interfacing with IBM Support, development, cross-brand solution teams, and supporting post-sales support situations. Must have a strong track record of effective teaming and leadership, excellent communication and project management skills, hands-on experience with WPLC solutions, and client facing skills.

Cool stuff, eh? If you are interested, please send me an e-mail and we'll talk.

Drag & Drop From One Database To Another

I recently had someone ask me a question about some of the drag and drop techniques I use in my applications. One of the questions was whether or not you could drag and drop between databases. I can't recall ever having done that before, but with a little clever coding, it can be achieved. Here's how:

To accomplish this, I actually use the same technique that you may have seen in the presentation Nathan and I gave at Lotusphere last year.

The first step is to create a new folder that will serve as the target for the drag and drop action. The design of this folder doesn't really matter unless you want to use it as a folder in your source database. Once your folder is created, you want to add an entry for the folder on either an existing outline or create a new one. In the outline, reference the folder and add an icon if desired.

In order to get the documents being dragged from the source database to the target database, it is necessary to add code to the Queryaddtofolder event of the view/folder in which the document originally resides (not the one you are dragging it to). This code will perform the work of copying the source document to the destination database. Of course, there's lots of flexibility with how you could write this code (and it's probably best to throw it into a script library and use it in the views/folders you need it), but here's a sample I put into my mail file.

Sub Queryaddtofolder(Source As Notesuiview, Target As Variant, Continue As Variant)

'Here you could branch code based on the target folder.
'In my case, I don't want anything special to happen unless I'm dragging to the "DragTarget" folder.
If Target <> "DragTarget" Then Exit Sub

'In the case of my mail file, I don't want any docs actually going into this folder, so we'll set Continue to false, which will prevent this.
Continue = False

Dim session As New NotesSession
Dim collection As NotesDocumentCollection 'The documents selected (i.e. being dragged)
Dim doc As NotesDocument 'The doc in the source database
Dim newDoc As NotesDocument 'The doc in the target database

'Hardcoding is bad...don't do it! :-)
Dim targetDB As New NotesDatabase ( "", "mail1\gtd.nsf" )

'Get the collection of docs selected and iterate through...sending them to the target db and moving them to the appropriate folder
Set collection = Source.Documents
Set doc = collection.GetFirstDocument

Do While Not (doc Is Nothing)
Set newDoc= doc.CopyToDatabase( targetDB )
Call newDoc.PutInFolder("($Inbox)")
Set doc = collection.GetNextDocument(doc)

End Sub

This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at

This is a look at the implementation from my mail file. I have another database where I keep my to do lists. Often, an e-mail initiates some kind of action on my part, so rather than copying and pasting from my mail file to my Task database, I can just use the drag and drop feature. This is how it appears in Notes 8 integrated into the new look and feel. (Nothing exciting...looks like it's just part of the interface...which is what I wanted)

I made it look a little different in Notes 7 by using a bigger graphic to serve as the drop target. Again, this is just an outline embedded on a page, so you could use any kind of graphic you want.

Pretty handy and easy to implement as well. Enjoy!

Friday, December 07, 2007

Introducing Raj...

Hi Folks. You know that the User Experience design team for Notes 8 used personas extensively in their development cycles. Well...I am really pleased to see the first of the application developer personas for Domino Designer, which was unveiled today. This is such a great persona...I expect we'll see a lot of good stuff come out of this. Congrats to the UE team! So what are you waiting for...go meet Raj! :-)

Print Anywhere...YEP...Anywhere!

Besides being a self-styled Lotus evangelist (I just bought a new car and am going to get some personalized plates...and I'm considering things like IM LOTUS, NOTES8 or, what a geek!), I'm also a productivity junkie. Anything that can make me more productive while allowing me to maintain high quality output is considered for part of my standard toolkit. I wanted to tell you about one of those tools that has just entered my arsenal.

Say you are at the office and you want to print something out but don't want to use work printers to do it. Maybe you'll e-mail it home or save it to a USB key, then bring it up on your home machine and send it to the printer. Yeah...that works, but sometimes it's a chore. Perhaps you don't have the same program on your machine at home, or the kids are hogging the PC chatting with their friends.

All of these potential time wasting issues are now a thing of the past thanks to Printer Anywhere. Printer Anywhere is an incredibly useful tool that allows you to print to a remote printer using the internet. Thus, in the scenario above, you could print directly from your work PC to your printer on the desk at home. The service works by installing their software on the machines you want to print to and from. It automatically recognizes printers connected to your computer and gives you the option of sharing them. When you want to print a document, you simply issue the print command, pick "Printer Anywhere" as the printer and then choose the remote printer from a list (you can search by user ID, name, etc.). The item to be printed gets packaged up and sent across the internet to the other device, where it rolls off just as if it was printed from the local machine. That's the simplified version anyway. You can find out all the details, plus cool features such as encryption and the like, by exploring the Printer Anywhere homepage.

I can see many unique ways to use this service and plan on exploring it more in the future. Thought you might be interested in checking it out too. Cheers!

Improved Layers Would Rock

It's no secret that I love using layers. So do Nathan, Ben, and a bunch of other people. Thus, I was quite excited to see Don posting this great tip on Idea Jam.

Please go vote it UP...I think you should! :-)