This entry was posted on Saturday, October 11th, 2008 at 9:50 pm and is filed under Formula, IBM Lotus Notes, Interface. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
BizzyBee’s BizzyThoughts
Think Outside The Hive - About Notes and Web
Create computed action hotspots on the flie using @Formula
We know the power of action and link hotspots. It would be great if we could create them computed, f.e. to give it a computed description or to create a number of hotspots that can vary. I’m sure you know some applications for this yourself (just nostalgically think of those times you bumped your head against the wall in rage ;-)).
It turns out not to be that difficult, but there are some gotchas and restrictions. But don’t be afraid, I’ll take you by the hand and show you where the mines are…
How does it look?
It could look like this:

The basics
The months in this example are generated in a computed value with @Formula. The computed value is marked as passthru html.
I used a multivalue field CostMonth and with a @For-loop I wrapped a link around every value.
@For(i:=1;i<=@Elements(CostMonth);i:=i+1;
@If(i=1;LB:=“”;LB:=“<br>”);
link1:=“javascript:clickRow(”+@Text(i)+“)”;
result:=result+LB+“<a href=\”“+link1+”\“>”+CostMonth[i]+“</a>”
);
@If(i=1;LB:=“”;LB:=“<br>”);
link1:=“javascript:clickRow(”+@Text(i)+“)”;
result:=result+LB+“<a href=\”“+link1+”\“>”+CostMonth[i]+“</a>”
);
The link is actually a link to a JavaScript function in the JSHeader that presses a button for us. Something like:
function clickRow(row) { document.forms[0].myButton.click(); }
Don’t forget to give the name/id “myButton” to that button. The button itselfs can hold formula, lotusscript or whatever your heart desires.
I used linebreaks <br> for new lines, I tested with <br/> as well, this didn’t work. But, we’re not there yet, this is the result so far:

Hey, that’s not the font I want! That’s not the color I like!
Changing font, color and interlines
I tried css to change the look of the links, but I had little to no success. Alternative: surrounding the link tags with <font> tags. This can alter the font color and font face.
Oh, but there was trouble, there were headaches, there was darkness! If I put the font tag outside of the link tag, the color didn’t change (because it took the default link color over. If I put it inside of the link tag, the interline is huge (and that makes sense, because the font is still wrong outside of the link tag).
So, what I did was changing the size and face outside of the link tag, and changing the color in the link tag. The code becomes:
@For(i:=1;i<=@Elements(CostMonth);i:=i+1;
@If(i=1;LB:=“”;LB:=“<br/>”);
link1:=“javascript:clickRow(”+@Text(i)+“)”;
result:=result+LB+“<font size=\”0\” face=\”Tahoma\“><b><a href=\”“+link1+”\“><font color=\”#0082BF\“>”+CostMonth[i]+“</font></a></b></font>”
);
@If(i=1;LB:=“”;LB:=“<br/>”);
link1:=“javascript:clickRow(”+@Text(i)+“)”;
result:=result+LB+“<font size=\”0\” face=\”Tahoma\“><b><a href=\”“+link1+”\“><font color=\”#0082BF\“>”+CostMonth[i]+“</font></a></b></font>”
);
Taking it further
Buttons can be generated with passthru as well, here’s an example:
@For(i:=1;i<=@Elements(CostMonth);i:=i+1;
@If(i=1;LB:=“”;LB:=“<br>”);
link1:=“javascript:clickRow(”+@Text(i)+“)”;
result:=result+LB+“<font size=\”0\” face=\”Tahoma\“><input type=button value=\”“+CostMonth[i]+”\” onClick=\”“+link1+”\“/></font>”
);
@If(i=1;LB:=“”;LB:=“<br>”);
link1:=“javascript:clickRow(”+@Text(i)+“)”;
result:=result+LB+“<font size=\”0\” face=\”Tahoma\“><input type=button value=\”“+CostMonth[i]+”\” onClick=\”“+link1+”\“/></font>”
);
Images can be used as well, but this is a bit more cumbersome, because the images will need the http task to be shown, so I don’t really recommend this.
Articles
Da Honey Pot
About me

October 11th, 2008 at 10:16 pm
This works nicely with notes://server/replica/0/docid Links to. I used this to do some “See also: . Unfortunatelly haveing computed html text seems to require, that there is a linebreak in front of it, so you can’t put such a link inside your normal text unles you put teh rest of the paragraph into the same passthru computed text.
October 21st, 2008 at 8:16 am
Nice article. Thanks.
Eugene
October 21st, 2008 at 1:16 pm
You’re welcome!
November 20th, 2008 at 9:18 pm
I’m a teacher of entrepreneurship in our school, and I think this document of yours can be of help to me and my students to become successful someday. Thanks a lot. god blezzz
November 23rd, 2008 at 1:45 am
This is such a cool technique: finaly translations for buttons! Now only two places remain: view headers and the labels for “action with subaction” (seems a bug, actions itself are using the right computed label)
December 8th, 2008 at 4:38 am
Nice post. Thank you for the info. Keep it up.