Friday, March 26, 2010

XPages: Computing the category label in categorized columns

I stumbled on this one while helping a colleague.

He had a categorized totals view that was categorized on id's referencing documents in another database. He wanted the category label to show the a value from the document the id came from. That's easy I told him (I hadn't worked with categorized views in XPages), just use @DbLookup..

Turns out it's not that straightforward. If you edit the value in the Data panel under properties, the column loses it's "connection" (the columnName attribute) to the categorized column in the underlying Notes View.

Edit property

Results in columnName disappearing

When columnName disappears, the column becomes a custom column, and the categorization (twisties/etc) disappears.

To be able to compute the label of the category, you have to go into the source and add the columnName property after you've computed the value.

What it should look like

That's all there's to it..

Share and enjoy!