Wednesday, October 7, 2009

Technique: Using a Page as a cross language template/string container

In this demoapp, I use a page as a definition for an XML-representation of a document. It is related to a project at work, where we send XML to a web service. This service is to be called both from the Notes Client, and from an XPage. I could script the XML in both the agent and the XPage, but this could easily develop into a maintenance nightmare.

In the demo, I've used the body of a page as a token string (separated by ¤). The first token is the field-definition. This is to be used in a formula evaluate towards a NotesDocument. The second part is the template itself.

By having the field-definition in the page, you just have to update the page if you want more field values.

I wrote three different script libraries, each having more or less the same functionality. One LotusScript library, one Java (Script) library, and one ServerSide JS library. The libraries contain functionality that extracts the body of the a page based on its name (using a NotesNoteCollection of the pages in the DB).

I also wrote a LS agent, a Java Agent, and a XPage (acting as an agent). Each of them prints XML (based on the template) for the first document in a certain view.

This technique can also be used if you have a big string that is used in code written in multiple languages. If it's Java-code you're writing, and need a big string, this may be an easier way to maintain the string. Another thing that occurs to me is if you generate the same XML/HTML/etc. in multiple databases, you can maintain the String-template in one database, and use Design inheritance to spread it (or get the page from another database using otherDatabase.CreateNoteCollection(false)... )).

As with all techniques, this might not be the right tool for your job. Weigh pros and cons before you decide to use it/not use it.

>> Download DemoApp (open the app in a browser to test the demos)

Comments/critique/bugreports are as always welcome. :)

Thursday, October 1, 2009

Not satisfied with Domino Designer documentation? Make your voice heard!

Got this in the mail yesterday:
Key team members are available exclusively on the
moderated forum through this Friday to read your feedback, respond,
and provide insight regarding functionality and content. All
questions, opinions, experiences, and feedback are welcomed.

Lotus Domino Designer documentation moderator team includes:
- Bob Harwood, the Information Development (ID) Lead for Domino
- Cara Viktorov, ID Customer Feedback Lead
- Steve Shewchuk - Designer ID manager
- Deanna Drschiwiski - Designer Information Architect
- Michael Stewart - Writer
- Bob Perron - Writer

See what your peers have already posted and participate at

Domino Designer Forum