Thursday, December 20, 2007

Readable lookups - Demo application

The demo contains:

I've made a simple index-page. If you download the app/open, you should see the links to the demos.

The demos aren't very exciting/useable. Take a look at the design elements for the "magic".

The Ajax-demo

Link "To the frontpage" is a part of the above flash-animation

>> Download demo-application

Semi MVC templating

In the templating-demo, I (believe) I've used the MVC pattern for templating/transforming lookups. If anyone knowledgeable about patterns reads this, please let me know if I'm way off on this.

I'm not sure if this is similar to the technique Chris mentioned in a somewhat cryptic comment on another templating blogpost.

I use a naming convention for three kinds of fields. To do the actual transformation, I use a WebQueryOpen-agent.

Naming convention/description

Computed for display, allow multiple values. These fields fetches the data (using dblookup/-column). One field can be used by multiple templates.

Computed for display. These fields contain the description of how the data should be transformed. The label should correspond with the label of a lookup-field. Example of template.

Computed for display. These fields will be filled by the result of the transformation. The label/description should correspond the label/description of a template-field.

WebQueryOpen agent
This agent contains the transformation logic/fills the transformed-fields.

Wednesday, December 19, 2007

Doing lookups on the web

Update, 20.12.07: Demo-application done.

I've finally gotten started with my templating-demo again.

One of the examples I promised was Ajaxy lookups (using the same view on the Web as in Notes). To make this happen, I thought it would be enough going to use ?OpenView&startkey=hello, but the effect of that "command" is start with documents starting with hello, then show the rest of the documents in the view.

A quick visit to my friend, google, sendt me along to an article on "Hidden" in the comments-section was my answer:

Alex Hernandez (Thu 5 May 2005 10:00) website / e-mail

Jake, I've been facing a similar problem when reading the "startkey", if the key doesn't exist, it returns the next set of documents, which is wrong. Now, if you add the "untilkey" to the url you can grab only the documents you need. This is true everytime you know how to compose the untilkey key, What I did was just adding a "_" to the end of my know startkey.

for example:

originally If I searched for "alexh" and the key doesn't exist, it returned the rest of the docs. now with the until key, it search for docs with ket between "alexh" and "alexh_" wich returns no documents, and that's what I expected.


Thank you Alex, Jake and google!

Wednesday, December 12, 2007


Fetching Post/Get parameters with an agent isn't easy in LotusScript with inbuilt tools.

I made this simple class today as a replacement for a get-only getParameter routine I used earlier. This class should handle both get- and post-requests.

My "documentation" (something new I've been trying out) of the class:

>> Class in a text-file
(the tabs are a little off in Notepad/Wordpad, but should look correct in DD)

>> Simple demoapp

Update, 01.07.2009: A small codechange to support multi-value requests. For instance from a form with checkboxes.

Update, 30.05.2008: There was a bug in the class. If you had a parameter containing "=", the parameter value would be cut off before =. The class is updated with the fix (demoapp not updated).

Update, 25.03.2008: I've updated the class so that it should handle request_content above 64k. Read more here.

Update, 13.12.2007: I updated the class with a method to print a html-report of the request, using the docToHTML-procedure in the previous post.

Update, 25.09.2008: Added functionality to fetch cookies from a request.

Debugging: Inspect what's being posted from a form

Sometimes I make parts of a form using PassThruHTML/hidden notes-fields. Mostly because Domino-generated HTML is hard to style (especially radio-buttons/checkboxes). This sometimes work immediately, and sometimes it takes hours to make it work. I've found it a great help to see what is being posted to the server.

There are HTTP-sniffer applications that you can inspect the request with, but I find it easier to post the form to an agent, and then print the request-content as a HTML-table.

Example of output, Jake's FakeNames database, Person-form with a couple of fields filled in.

It's also handy to "echo" get-requests when developing agents: A simple ?OpenAgent

In the demo-application for this blogpost, I've made a (javascript) action-button that rewrites the action-field in the form to point to an agent. The agent tries to print every field in NotesSession.DocumentContext.

To make this work in your applications, (hopefully,) you only have to copy the Script Library, InspectRequest, the agent inspectrequest, and the shared action, Inspect current form-values. Insert the shared action into the form you want to test.

To inspect DocumentContext in other agents, use docToHTML in the Script Library, InspectRequest. As a rare occurence, I've actually documented this function.

To get the current field-values, I trigger the equivalent of @Command( [ViewRefreshFields] ), using the Domino _doClick function.

>> Download demo application

Tuesday, December 11, 2007

IdeaJam: Let SearchView return XML, JSON

I've wanted this functionality so many times in Domino (for Ajaxy applications). Hopefully blogging about it will increase it's visibility, and get more people voting for it.

Sunday, December 9, 2007

What if....IBM collected all the best tips of the N/D "blogosphere" into a Redbook?

(Sorry for stealing your subject "pattern", Bob)

I watched a japanese TV-show some weeks ago, where they interviewed a couple of japanese bloggers that converted their blogs into book-format.

It would be great, if someone like IBM could extract all the best tips/techniques/patterns/etc. from the N/D "blogosphere" into a Redbook (along with accompanying demo-dbs) yearly.

Maybe this would help motivating even more people to spread their knowledge through blogs.

Saturday, December 8, 2007

Readable lookups: Lookups -> HTML with formula

Update, 20.12.07: Demo-application done.

To avoid making a monsterpage, I'll split up the different tricks you can do with the readable lookups technique.

First example, generating HTML from lookups with templating, in a readable way. I'll post a demo-db when I'm done making examples.

The lookup-view

First, I create a lookup-view.

First column: firstName + " " + lastName
For real-life apps, I mostly use ComputedWhenComposed-fields with @Unique as a general lookup-field.

Second column:

The advantage in writing it this way is that all you have to do to add more data is to add the field-name to the fields-list. Another advantage is that there is less chance of typing errors, as less is written. The biggest disadvantage is performance. If you have a lot of documents (maybe 20 000++), I'd think the above way of writing the column formula would be more resource-heavy on view-indexing than if you simply concatenate strings.


First, take a look at my previous, less readable technique, where i had pipe-separated lookup-data.

New, "self documenting" lookup -> HTML technique:
Definition lists
A table

>> Result of the above to examples

Top 5 browsers of my visitors Jan-Jun vs Jul-Dec

Inspired by, here is this blog's browser statistics:

A little disappointed that my favorite browser, Opera, is less represented at the end of the year than at the beginning.

Friday, December 7, 2007

Readable lookups

Update, 20.12.07: Demo-application done.

A colleague of mine, Torbjørn Halsne, found a better/more readable way of creating readable lookups than my "Keyword/Value lookup fields", on searchdomino.

The technique.

The worst part about my K/W-technique was that it wasn't really suitable for lookups that returns more than one value.

This new (to me) technique adds overhead on view-indexes, but you get a lot in return.

I'm working on a demo to show all the great stuff you can do with this technique. E.g. using the same view for server-side lookups as client-side lookups (XML), a lot more readable formula-templating and hopefully (if it's not too time consuming/me too lazy) LS-WQO templating demo.

Hopefully I will have it ready/online before the end of the weekend.

Thursday, December 6, 2007

Google Charting API

Google has just released an interesting, easy to use charting API.

Very simple example:

img src:

The following types of charts are available:
  • Line chart
  • Bar chart
  • Pie chart
  • Venn diagram
  • Scatter plot

Read more about it here

Wednesday, December 5, 2007

I love Ray Ozzie

Well, actually I don't love Ray Ozzie, but someone does.

Just spotted this t-shirt on

Tuesday, December 4, 2007

Rant about the apparent lack of "serious" Notes/Domino programmers

Started of as a comment on "The reason the Domino Development Platform Isn't Taken Seriously", where Craig asks if it's time for the DominoDevs to grow up. My rant is also influenced by the comments posted on Nathan's "Sanity Check" that OO is the way to go/most N/D developers are lazy.

Start rant:
This is just a wild guess, but don't think that the majority of N/D developers are willing/able to make the effort to write "serious" code.

Then again, how many applications need the complexity that is Java/OO/Inheritance/MVC/etc?

The recent discussions on the future of N/D remind me a lot about discussions about JavaScript, which also has had the toy stigma for most of it's life.

It's not until the Ajax-term is coined by a well respected person in the community, Jesse James Garrett, that suddenly JavaScript is THE language to learn. Then Douglas Crockford steps in and show the "serious programmers" all the amazing stuff you can do in JS, and all of a sudden, all platforms must have JavaScript.

Now the "serious programmers" want to tighten JS (with EcmaScript 4), and make it more serious (or more precisely, make it fit their world..?).

JavaScript is a forgiving language, just as LS. There is a lot of awful code being written in JS, making sites/applications brittle/insecure. If you force strong typing/classical inheritance/etc. on all JavaScript-developers (as some feel that EcmaScript 4 will), how many are you going to have left? Will the tightening of the language be worth the loss? Is the proposed tightening of the N/D-platform going to be worth the loss of less advanced programmers?

I believe that what we as a community (and Notes/Domino as a platform) need, are people who love and understand what is great about the platform, and also are able to sell the concept to developers -and- IBM. Until I see the next designer, I'm firmly convinced that the decision makers of Lotus/IBM doesn't understand what is great about the platform. From looking the latest releases (6/7/8), they see it as a collaboration/mailing platform. N/D isn't great because IBM has made a great mail/calendar application with it, but maybe the mail application is so great because of the (mysterious/genious) concept that is Notes/Domino..?

Regarding lazy/untrained developers:
Great code != Great application from the users perspective, just as Horrible code != Horrible application. Great code will probably lead to a more stable/secure/maintainable/expensive application.

If you want N/D developers to write serious code, and you believe you know how to teach them, why not go together with other great minds and write a book to enlighten them? There must be publishers willing to still publish N/D books..?

With all the Agile development books coming out recently, where is "Agile application development with Notes/Domino" (horrible title, I know).

Other titles I'd like to see:
"Web 2.0 with Domino" (although I hate the term web 2.0, it sells)
"Rich Internet Applications with Domino"
"Enterprise applications with Domino 8"
"Object Orientated programming in LS for dummies"
"Taking advantage of DB2 with Domino 8"
etc. etc.