Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Display Latest 5 Documents

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#Display Latest Documents or http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/Display Latest Documents


How do you display the latest 5 documents on a web page? Here is the complete code and explanation.





To display the last few documents created or modified on a web page is not as trivial as first thought.

 

The easiest way is to create a view LastDocs with date as the first column and then sort it descending.

To display the view with only the first (or last) 5 documents showing can be done using the ?openview&count=5  code

on the end of a view.

 

The view can be  displayed in an Iframe if you are not worried about search engines.

REM {Displays last 5 Release document by issue date};
DBName := @Implode(@Explode(@Subset(@DbName;-1); @Char(92));"/");
url:="/"+DBName+"/LastDocs?openview&count=5"
"<IFRAME height=100 width=712 scrolling=no frameborder=0 marginwidth=0 marginheight=0  src='"+url+"'>"+
"<a href='"+url+"'>here</a>"+
"</IFRAME>"

To be really cool, automatically change the size of the iframe to fit the content by going here: http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/IframeHeight .

Might be best to create a $$ViewTemplate for LastDocs form that has the Head Head COntent set to:

"<base target='_top' >"

This will make sure the links replace the current page and do not open in the iframe!

If you do not want to use the Iframe, then there are other options, create a function that does a @dbcolumn and a @subset, this could be tricky and slow on a big view, or create an agent that creates javascript on the fly like a google adsense script. I will create an article on this at a later date.

 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Beginning Java Web Services by Andre Tost, Henry Andre Bequet, Meeraj Kunnumpurath, Sean Rhody
Web services are no longer a nascent technology in the programming industry; every major software vendor is rolling out web services-related APIs and products. Today Java developers are successfully adopting web services as the latest technology in application development in order to enable...
See at: Amazon.co.uk | Amazon.com |