administration mode

 

Formula Optimizations »

FERDY CHRISTANT - MAY 30, 2004 (03:34:56 PM)

The R6 formula engine is great. I love the new @Functions, they make things more easy on the web and allow you to write portable code. Additionally, you can create very elegant and short code by optimizing your old code. Here's an example:

code next

It is the optimized and shortened version of an older code fragment I wrote. The code tries to mimic the @Command( [NavigatePrev] ) function on the web. This is what you need if your Domino form is pure (X)HTML, because you can't use some of those commands then.

New is that I dynamically retrieve the view alias. Furthermore, I use the new @IsNull functions to check on, well..null values. The most interesting line is the one in which I use the new @Max function to replace an @If statement. A lot more elegant, right? It really pays of to know the new @functions to find better or new ways to code your solutions.

For the curious, here's the code that mimics the @Command( [NavigateNext] function:

code next

As you can see, the navigate next code has a @DbColumn in it. It is needed to calculate the number of documents in the current view, which is needed to overcome the problem of navigating to a document in the current view that does not exist. Apart from that, both code snippets are portable, as I have been able to paste them in all my XHTML view templates without any modification.

Looks like us Lotus geeks have a new sport: formula optimization.

CREATE A NEW COMMENT
required field
required field HTML is not allowed. Hyperlinks will automatically be converted.
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30