Rocky Oliver has a really cool article over on his LotusGeek
site called Formula Big Top Preview: The Elusive @Transform
. In it, he describes the powerful @Transform function, added to formula language for Notes/Domino 6.x. I'd suggest you go to his site to read all about it, but I'll excerpt one little bit:<blockquote>@Transform works against a list, and executes a formula against each individual element of the list, returning the modified list as the return value. The syntax of @Transform looks like this:
|@Transform(list; name of variable; formula to run)|
parameter is the list you want to work against.
The name of variable
is a string that represents a single value in your list in the formula to run.
The formula to run
is the single line of formula code you want to run against each element in your list.</blockquote>So, at the risk of being obsessive, how could you possibly use this with @Midas Formulas, which works on rich text fields?
It turns out, there are several ways. I'm just going to show a simple example today, but tomorrow I'll show a much more powerful example, having to do with HTML generation and related to our on-line demo @Midas A La Carte
(which you should try if you haven't, as it is entertaining if nothing else).Getting Counts for Rich Text Targets
Let's say I want to find out the count of a number of different objects in a rich text field. Let's say, for example, I want to find the number of tables, sections and URL hotspots. My code could be:
object_list := "Table"
counts := @Transform
(counts; ", "
This returns the result Table=1, File=0, URLLink=3
for this blog posting so far (with the fieldname changed to match this field).
Of course, we could make this a list selected by the user from a checkbox field, and the formula would not have to change at all. Pretty cool. But as I said, I have a more powerful example in mind which I need to write up and test tomorrow. Now, back to Rocky's site to set up a trackback so he knows somebody
is reading his articles <grin>.
Copyright © 2004 Genii Software Ltd.