dominoGuru.com

Your Development & Design Resource

Making a Dynamic Read-Only Form for Traditional IBM Lotus Notes Domino Apps

Sometimes you need a simple show-all Form to get the job done... here are two development techniques using Traditional IBM Lotus Notes Domino Design Elements.

Making a Dynamic Read-Only Form for Traditional IBM Lotus Notes Domino Apps I was working on a new assignment this week where I needed to create a simple read-only Form Design Element to display aggregated data to the user. Easy enough, but here's the catch: I didn't know which NotesItems would need to be displayed by a correlating UI Field, as the data aggregation and population process was creating NotesItems in a given NotesDocument based on various logic.

While I can't get into the particulars just yet, here's a real-world example that you might run into:

Let's say you're integrating one of your IBM Lotus Notes Domino apps with a 3rd-party Web Service. Most enterprise-level web services allow you to put a "callback" URL to transaction logging. This URL would act as an HTTP Request Consumer, pulling all supplied information from the 3rd-party web service and creating a transaction log NotesDocument.

Now... because I'm lazy, I don't want to have to go in and re-code the Form Design Element that acts as the User Interface for these transaction log NotesDocuments... so I started using these techniques:

Tabbed Computed For Display Fields

Since this is Read-Only, I can simply display the Fields and their correlating NotesItem values via a Computed for Display Field with the following Formula:

f := @DocFields;
@For(n :=1; n<=@Elements(f); n:= n + 1;
list := list : @Text(f[n] + @Char(9) + @Text(@Implode(@GetField(f[n]); ", "))));
@Trim(list)

(@Char(9) -- using above -- is a single Tab character.)

Next, you make your Computed For Display Field multi-value, displaying separate values via New Line.

Where this gets good is the next step. In the Text Properties for the Paragraph containing this Field, you can set the Tab Stops to 1.5", which gives you a clean two-column display for your NotesItems.

While this technique works by giving you simple User Interface control via Text Properties, Font Faces, Weight, and Color... it is limiting.

Once you wrap past to the next line in your UI, the NotesItem data no longer remains in it's Tab-based column, and displays in-line with the labels.

That's why I use this method:

Two-Column PassThru HTML Tables via Computed Text

Same idea here, in that you're going to use Formula to generate the Read-Only content... but that's where the similarities end.

The first step is to create a new Computed Text Element on the Form, then highlight that entire Paragraph as PassThru HTML.

The Computed Text Element Formula:

f := @DocFields;
@For(n :=1; n<=@Elements(f); n:= n + 1;
list := list + @Text("<tr><td valign=top><font face=\"arial\" size=\"1\" color\"black\">" + f[n] + "</font></td><td><font face=\"arial\" size=\"1\" color\"gray\">" + @Text(@Implode(@GetField(f[n]); ", ")) + "</font></td></tr>"));
@Text("<table>" + @Trim(list) + "</table>");

Here I am actually creating a two-column table to act as a data grid via PassThru HTML.

This particular version of the technique allows you to put more data on-screen while keeping the user interface nice and clean.

It's drawback is apparent: Not only are you relying on PassThru HTML support in the Lotus Notes Client which may or may not work depending on your particular Client release, but styling has to be done via the markup (or CSS, which brings us back to backwards-compatibility concerns).

Conclusion

You may never need this technique... but if you do, here it is.

A few ways that I have improved on it was to create a list of labels for a given NotesItem based on the NotesItem name, and use that for the label column for the given NotesItem.

Mailer Read-only Transaction Log Form

You'll actually see this technique in-practice in my Mailer app (shown above).

Of course, all of this is moot once you embrace the flexibility of XPages, Repeat Controls, and the ability to completely control the rendered content to the specific Client type.


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of dominoGuru.com, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.



More from dominoGuru.com


dominoGuru.com is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, dominoGuru.com by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.