News Stay informed about the latest enterprise technology news and product updates.

Ordering pictures on a page from a Web-based DB, redux, part 2

extention of Ordering pictures on a page from a Web-based DB, redux, an ATE response from Domino development expert, Andre Guirard.

This is the continuation of Andre Guirard's answer to Ordering pictures on a page from a Web-based DB, redux Ask the Expert question.


If there aren't a lot of images, the best way might be to create a view that contains one column that calculates the data you want in the array; for example, the view column formula might be:

@AttachmentNames + "|" + @Text(@DocumentUniqueID) 
Then on the form enter a formula in the HTML Head Content, like this:
_tmp := @IfError(@DbColumn(""; ""; "viewname"; 1); ""); 
"<SCRIPT language='JavaScript'>var imageData = new Array(" + @Newline + 
@Implode(""" + _tmp + "",", @Newline) + ");</SCRIPT>" 
Now you can write code that uses the imageData array to create HTML, which you then assign to the innerHTML property of a division.

If you have too much data for an @DbLookup, you can still produce the imageData array, but it requires more work. It's a little too complex to go into great detail here, and in fact I haven't tried it myself, so I might be missing some important detail, but I know this approach can be made to work. Create a view named something.js, create a form "$$ViewTemplate for something.js" and put static text on the form above and below the view:

var imageData = new Array( 
[embed view here] 
""); 
Make sure the view is set to display in HTML and show a very large number of rows -- all of them. You can then have a column formula similar to the above, but it needs to include the quotes and commas:
@Implode(""" + @AttachmentNames + "|" + @Text(@DocumentUniqueID) + "","; " ") 
Since the final row will have a comma on the end, you need an extra element before the final close parentheses of the array definition, hence the final "", which your code will ignore. You should set the view template form's "content type" to "Other", and type in "text/javascript" -- I think.

Then, you can use a formula in the HTML header, to include this ".js file" from the server:

"<SCRIPT language='JavaScript' src='/" + @WebDBName +
"/something.js?OpenView'></SCRIPT>"

Dig Deeper on Domino Resources - Part 6

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close