Wednesday, October 19, 2016
Friday, February 19, 2010
Generating PDF Documents From Templates
http://codestore.net/store.
in reference to: Generating PDF Documents From Templates | Mon 23 Nov 2009 | Blog | CodeStore (view on Google Sidewiki)
Simple LotusScript NotesDocumentCollection Iteration
How To
Function setManager(col As NotesDocumentCollection) Dim s As New NotesSession Dim doc As NotesDocument Dim nab As New NotesDatabase(s.
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
Not a big change here, but using the getNextDocument steps through the NotesDocumentCollection and scales much better than the dreaded getNthDocument.
Conclusion
So what have we learned?
1. There's no environment in the world where the above scenario would actually exist.
2. I suck at creating Use Cases...
3. getNthDocument is evil. If you come across it in your production code, you might as well just unplug the Domino server.
4. getNextDocument-based iterations scale!
And, most importantly, NotesDocumentCollection iteration is an extremely powerful technique that can allow you to process large numbers of NotesDocuments with applied logic at the individual NotesDocument-level.
There are several methods complete with built-in functions in LotusScript that allow you to iterate through NotesDocumentCollections, NotesViewEntryCollections, and such... so I'll start off by defining a simple use case, and then showing you how not to iterate through a given NotesDocumentCollection, and then ultimately showing you a solid approach to NotesDocumentCollection iteration!
Use Case
A scheduled Agent for a simple Project Management application will evaluate each new NotesDocument since last run and -- since we're going for simple here -- update the manager NotesItem with the value stored in the submitter's Person Document in the Domino Directory. Since this is an ideal world, every Person Document manager is both defined and contains the common name matching the manager's own Person Document.
Author's Note: Yeah, this would never happen, but this is a use case for iteration, not chasing down the manager NotesItem values... so go with me on this one.
How not to...
The below LotusScript uses the getNthDocument function to loop through a supplied NotesDocumentCollection and perform whatever NotesDocument application logic is needed (in this case, a Domino Directory lookup and NotesDocument update & save).
Function setManager(col As NotesDocumentCollection) Dim s As New NotesSession Dim counter As Integer Dim doc As NotesDocument Dim nab As New NotesDatabase(s.
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
If you have 5 NotesDocuments, this isn't that bad of an approach. I still wouldn't use it though and the reason is pretty simple: it scales horribly, and we're coding for the species here people!
in reference to: Simple LotusScript NotesDocumentCollection Iteration | dominoGuru.com (view on Google Sidewiki)
Monday, January 5, 2009
@SetTargetFrame and @URLOpen
Below is the illustration -
@SetTargetFrame("_blank");
@URLOpen(urlstring)
Sunday, November 9, 2008
Search on single field using SearchView
If you want to search a view for specific field value then you can use SearchView as shown below.
Ex. If you want documents having "Yes" as value for "IsActive" Field then you can use SearchView as given below.
Wednesday, October 22, 2008
"splice" - JS method to add/remove array elements
Definition and Usage
The splice() method is used to remove and add new elements to an array.
Syntax
arrayObject.splice(index,howmany,element1,.....,elementX) |
Parameter | Description |
index | Required. Specify where to add/remove elements. Must be a number |
howmany | Required Specify how many elements should be removed. Must be a number, but can be "0" |
element1 | Optional. Specify a new element to add to the array |
elementX | Optional. Several elements can be added |
Example
In this example we will create an array and add an element to it:
<script type="text/javascript"> var arr = new Array(5); arr[0] = "Jani"; arr[1] = "Hege"; arr[2] = "Stale"; arr[3] = "Kai Jim"; arr[4] = "Borge"; document.write(arr + "<br />"); arr.splice(2,0,"Lene"); document.write(arr + "<br />"); </script> |
The output of the code above will be:
Jani,Hege,Stale,Kai Jim,Borge Jani,Hege,Lene,Stale,Kai Jim,Borge |
Example
In this example we will remove the element at index 2 ("Stale"), and add a new element ("Tove") there instead:
<script type="text/javascript"> var arr = new Array(5); arr[0] = "Jani"; arr[1] = "Hege"; arr[2] = "Stale"; arr[3] = "Kai Jim"; arr[4] = "Borge"; document.write(arr + "<br />"); arr.splice(2,1,"Tove"); document.write(arr); </script> |
The output of the code above will be:
Jani,Hege,Stale,Kai Jim,Borge Jani,Hege,Tove,Kai Jim,Borge |
Example
In this example we will remove three elements starting at index 2 ("Stale"), and add a new element ("Tove") there instead:
<script type="text/javascript"> var arr = new Array(5); arr[0] = "Jani"; arr[1] = "Hege"; arr[2] = "Stale"; arr[3] = "Kai Jim"; arr[4] = "Borge"; document.write(arr + "<br />"); arr.splice(2,3,"Tove"); document.write(arr); </script> |
The output of the code above will be:
Jani,Hege,Stale,Kai Jim,Borge Jani,Hege,Tove |