Welcome to

The Conxsys Blog

Thoughts on Conxsys, Notes/Domino, LotusScript, & Technology

SnTT: Adding a Database Size Indicator to Notes 8

April 24th, 2008 by Corey Davis

Show-n-Tell ThursdayI have been meaning to post this SnTT for several weeks now, but have not found the time to finish it. Chris Miller’s post yesterday, Do Your Users Understand a Stoplight Signal?, points out the new and improved quota reporting in the 8.0.1 mail template and has prompted me to finish this post. Yes, I agree, the new graphical quota reporting is a beautiful thing. But, what to do if you (or your customer) does not use quotas yet wants to provide some type of theoretical limit to their users and display a disk usage meter just like this one for quotas?

If your first reaction is to just throw your arms up in the air and say “Oh, come on! Just implement the quotas!” then you would be exactly right. However, that would not make for a very fun SnTT now would it? So, here’s what I did:

Disk Indicator Green Disk Indicator YellowDisk Indicator Red

First, you begin by stealing, err, leveraging Martin Vereecken’s work. His implementation addresses Notes 7 and below, but we are concerned with Notes 8. So, we start by copying the DbSizeGraphic form from Martin’s example into our mail template (you will notice that in my example the form is called FileSize; I only changed it because FileSize is the legacy name of the form we have used to display the file size in mail files since R5).

FileSize Form

I then modified the PostOpen code to allow for the fact that we have this hardcoded theoretical file size limit and not quotas. And don’t even get on my ass about hardcoding, ‘kay? I despise hardcoding values as much as the next developer, but I did it anyway. Deal with it.

Sub Postopen(Source As Notesuidocument)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db=session.CurrentDatabase
Dim doc As NotesDocument

Set doc=Source.DocumentSize = Cdbl(db.Size) / 1048576
MaxSize = 140 ‘Hard-coding quota size; remove if real quotas are used

doc.FileSize = Cstr(Round(Size,0))+” MB used”
doc.SizeAllowed = Cstr(Round(MaxSize,0)) & ” MB allowed”
End Sub

I made a few other changes such as getting rid of the SizeDescription field and added a FileSize and SizeAllowed field. I also changed the background color of the form to RGB 176,192,208 to match the Notes 8 colors.

Next, we need to get this into the sidebar. In Notes 7 that would mean modifying the framesets, but that doesn’t work in Notes 8 because the PIM applications are composite applications. So, we need to modify the template in the Composite Application Editor. To do this, open the template in the Notes client. Then, select the Action -> Edit Application menu option. This will launch the CAE.

Now we need to add the File Size component so that we can add it to the Mail page. To do this, select the menu option Tools -> Component Palette -> Add Components -> Add NSF Component. If you are asked to switch to the My Palette palette select OK. You should now be presented with a New NSF Component dialog box.

NSF Component

Give it a name and description, then click the Browse button next to the Notes URL field in order to assign the form. In the Locate Object dialog, the Kind of Object is Form, the Application is – Current Database -, and the Form is FileSize. Click OK. This will place you back in the New NSF Component dialog. Press OK.


To actually add the new FileSize component to the application, open the right-side Component Palette if it is not already open. Find the FileSize component, probably under General, and drag it under the Notes Mail Mini View component.

Add Component

You will need to adjust the height to your liking. When you are finished, select the menu option File -> Finished Editing. When asked if you want to keep the changes, answer Yes.

And that is it. Now that you have the component in place, if in the future you need to change the code in the FileSize form you can without needing to go back into the CAE.

While this works, there are some gotchas. First, users can re-size the components and essentially hide the disk space meter. Also, small window sizes will break up the meter. I can find no way to prevent either from happening. But, the worst problem is that once the database is opened the meter is static. A user can add or remove hundreds of meg’s of data and the meter will not change. I toyed a little with timers and such, but that really didn’t work out very well. If I find a good solution I will post it, but this is far from a priority at the moment, so I issue a challenge to all of you to find a good solution to these gotchas or a better solution to the problem that I present. And, yes, issuing a challenge on your blog to solve a problem is really just a way for me to get you to do my job for me. But just think of the momentary fame you will bask in should you solve this problem!

Related Links:
BizzyBee’s: Notes Mail Database Size Indicator – graphic version
IDoNotes: Do Your Users Understand a Stoplight Signal?

Posted in Domino, SnTT, 20,569 views, 5 Comments
Digg This Submit to del.icio.us Submit to Technorati  

5 Responses

  1. Chris Miller Says:

    Nice work. You can also cheat and set a crazy high quota number no one would hit just to get it to show also. Not good for users since the word quotas then shows. But fun to play with

  2. Pierre Passin Says:

    This is very nice but I am struggling to get rid of the horizontal scrollbars for the FileSize component when displayed as a composite application. How did you manage to do it ?

  3. Corey Davis Says:

    Pierre, it is a bit difficult to diagnose without seeing it, but I can guess at two possible issues:

    1. You might need to adjust the height of the FileSize component from within the CAE. It takes a bit of guess work and back & forth between CAE and the client to get it right because of the extra elements that the CAE adds (tab, min/max buttons).

    2. The other possibility is that you simply have some extra text, spaces, or carriage returns in your FileSize form that is causing the Notes client to believe that there is more to show on form and thus displaying scroll bars.

    I certainly hope this helps.

  4. Pierre Passin Says:

    Thanks, let me give it a shot. Admitedly I am finding the CAE to be very annoying.
    Also the timer code that was posted in the bizzybee.be seems to work to get the indicator automatically refreshed

  5. Corey Davis Says:

    Yes, I did see that Martin posted the timer code but it didn’t work for me on the first go. I kept getting a dialog asking me if I wanted to save the document when exiting the database. I am assuming that I did something wrong, but haven’t had the time to look into it.

    BTW, for everyone’s benefit Martin’s timer code is here: http://www.bizzybee.be/2008/06/10/notes-mail-database-size-indicator-for-notes-8-basic/

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

CC-GNU GPL Creative Commons License
The Conxsys Blog by Corey Davis is licensed under a Creative Commons Attribution 3.0 Unported License unless otherwise specified. Based on a work at conxsys.com/blog. All code on this blog is licensed under the CC-GNU GPL version 2.0 or later unless otherwise specified.

Copyright © 2006-2010 by Conxsys | Login | Powered by Wordpress | Template based on a design by Design4