Question

  Asked: Feb 12 2008   2:58 PM GMT
  Asked by: Mrg


Implode function with full javascript loop


LotusScript, JavaScript, @implode

Is it possible to use the @Implode function, as a formula for a column value in a view?

I'm creating a Photo Gallery, but I want the thumbnails created in a table, 3 per row.

I've set up a column to create the table, and find the appropriate photos, I just can't create rows.

I want to do something like this:
(y is hard coded to 10, but will be replaced by the number of attachments.)

doc:=@Implode("[<script type=\"text/javascript\">
var y=10;z = y;
for (i=0;i<y;i++){
if(z % 3 == 1)
{document.write(\"<tr>\");
document.write(\"<TD vAlign=\"top\" width=\"113\"><font face=\"Arial\" size=\"2\"><p><a href=\"" + ViewURL + "\"><img src=\"" + "/"+DatabaseURL+"/"+ DocumentURL+"/$File/" + @AttachmentNames + "\""+ " width=\"100\"></a><br>" + @AttachmentNames + "</p></td>);
z--;
}
else
{document.write(\"<TD vAlign=\"top\" width=\"113\"><font face=\"Arial\" size=\"2\"><p><a href=\"" + ViewURL + "\"><img src=\"" + "/"+DatabaseURL+"/"+ DocumentURL+"/$File/" + @AttachmentNames + "\""+ " width=\"100\"></a><br>" + @AttachmentNames + "</p></td>}}</script>]");

doc

Any help would be great...
Cheers
-mrg.

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0



Something along these lines will work, but you seem to be creating unnecessary complications for yourself by using JavaScript. Just have your view column code generate the HTML directly, then you will not have this confusion with your quotes (that's what prevents your current code from working). So the formula might be:

_names := @AttachmentNames;
_count := @Count(_names);
_rowbreaks := @Subset(@Explode(@Repeat({,,</TR><TR>,}; (2+_count)/3); {,}; 1); _count-1) : "";

"<TR>" + @Implode({<TD valign="top" width="113"><img src="/} + @WebDBName + {/0/} + @Text(@DocumentUniqueID) + {/$FILE/} + @AttachmentNames + {" width="100"></td>} + _rowbreaks; "") + {</TR>}
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Lotus Domino and Development.

Looking for relevant Lotus Domino Whitepapers? Visit the SearchDomino.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Mrg  |   Feb 21 2008  9:22PM GMT

Genius! That’s exactly what I wanted to do. I can’t say that I completely understand the code, but it definitely works. I’m gonna have to spend some time dissecting it.
Thanks!