I remember back when I first started with Notes development having to create tables on Notes Forms to display data held in fields in the same document. Maybe you did something similar whereby you'd use one multi-value field for each column of data and add a table to your form with one field in each column. Then you'd hope there was no wrapping. All very messy.

Having not done any real Notes development for 10+ years it's not something I've thought much about since. Until last week when I needed to display a table in the Notes client.

If I was in any doubt that my career is on a circular path then the fact I've just been developing for the Notes client can only confirm this.

Anyway, it turns out there was a better way of doing it, which worked quite well and I feel compelled to share, as it's not something I'd thought possible until I tried it.

The requirement I had was for tracking parcels using a courier's Web Services. Each "shipment" document in the Notes database has a tracking number in it. My job was to write a scheduled agent to regularly update the tracking data and mark documents as delivered or raise alerts for any issues.

I also needed to produce a visual way of displaying progress for each shipment, which ended up looking like this:

What you see above is just a standard Notes document opened in the Notes client. The table itself is standard HTML stored in a MIME-based field. All that my Java needed to do was build the table and stick it in a field. The fact I managed to make it look nice at the same time with a little CSS is an added bonus.

The data is purely for visual reference, so the fact the field can't be interrogated in any way isn't an issue. And, also, because the courier always returns all tracking data with each call to the service I can just delete and re-create the field and the table from scratch each time.

Job done. Remember, MIME is your friend.

Comments

Good stuff ... I embarked on something similar recently but ran into a snag when needing to display icons in some columns. Since the table was being included in an email, the gifs needed to be attached to the message in the event the message was viewed offline.

No .. due to time constraints I went in another direction. Inline images are no problem, but it was my impression that the image file(s) needed to be attached to the message if the user was viewing it while not connected? If not then I'll have to take another look at that.

That's right. For offline viewing you attach the image to the MIME field in base64 encoding and then you can refer to it directly from within your HTML by using an ID you assigned to the file while adding.

It's not too hard to do. The hard part is getting it to work on all email clients. Last time I tried that I gave up in frustration at what appeared to be a bug in the way Notes handled multipart MIMEs.

The process is the same for XPages, but it's overkill to use MIME when the browser already supports HTML. Also, repeat controls are normally more efficient (performance & memory) than generating, encoding, and displaying a long HTML string.