Friday, March 02, 2007

NotesNoteCollection + ExportDesignElement + NotesDXLImporter

Here, I try to explain you how we can change design document with Lotus Script.
For example you want to put a subformA from database1 to formA in database2.

1) So, firstly you must copy our subform from database1 to database2.
Dim nc As NotesNoteCollection
Dim doc As NotesDocument
Dim El As String
Dim nid As String, nextid As String
Dim i As Integer

Set nc = db.CreateNoteCollection(False)
Let nc.SelectSubforms = True
Call nc.BuildCollection

Set GetNoteElement = Nothing
Let nid = nc.GetFirstNoteId

For i = 1 To nc.Count
Let nextid = nc.GetNextNoteId(nid)
Set doc = db.GetDocumentByID(nid)
Let El = doc.GetItemValue("$TITLE")(0)
If El = “subformA” Then
Set GetNoteElement = doc
Let i = nc.Count
End If
Let nid = nextid
Next

...
And then copy to database2 as usual notesdocument.
...

2) This is main step. You must take a formA from database2 and export it, then take the content of export file and add to it

Dim s As New notessession
Dim stream As NotesStream
Dim content As String
Set stream = s.CreateStream
If Not stream.Open(filepath, "UTF-8") Then
Print "Not open"
Exit Sub
End If
If stream.Bytes = 0 Then
Print "Not content"
Exit Sub
End If

Let content = stream.ReadText()

If Instr(content, {wtInclude}) = 0 Then
Let content = Replace(content, {}, {})
End If

Call stream.Truncate
Call stream.WriteText(content)
Call stream.Close

3) Then you must import this file to database2.

I tested it on XP and 2000, and it worked.

Sunday, February 18, 2007

Difference between “garbage collector” in Lotus Notes/Domino and Java

As you know, when you work with Lotus Notes/Domino as developer, you never think about deleting objects. I mean, when you create a new NotesDocument you never delete it because Lotus Notes/Domino do it automatically. It’s really good feature if you work with Lotus Script, but when you write on Java, for example, Agent on java, you must always use method recycle() for memory release. I want admit, when you call method recycle() for object_A, then method recycle() automatically call for any objects that are created from object_A. It means that calling recycle() on a database object will also do recycle() for all objects obtained through this database.

It is important to remember that only one reason for calling recycle() is to release memory when you write an on java.

Wednesday, February 14, 2007

Notes.jar and Eclipse

Yesterday I tried to connect Notes.jar (java library in Lotus Notes) to my simple Java application in Eclipse 3.2. I had some problems with it. When I added Notes.jar and tried to compile my project, debugger gave me an error. I began to search information about it and found interesting article. A problem was very simple, I didn’t think about “Environmental variables”, so when I added them, my application was compiled!

Monday, February 12, 2007

second project on guru.com

One week ago I won another project on guru.com

Firstly, I fixed some bugs in modified mail6.ntf. The main problem in this task was difference between mail6.ntf in version R6.5.1 and R6.5.5.

Then I must developed something like as plug-in for Lotus Notes. The main goal of this plug-in is to be universal for both Lotus Notes R6.x and Lotus Notes R7.x. Earlier my customer had many problems with different mail6.ntf. He told me to do a subform in Lotus Notes Domino, that would be embedded in any forms in mail6.ntf.

I did it yesterday and send it to him. Now I will wait for answer from him.

I'm "free man"

I have finished my University www.nau.edu.ua with master's degree in computer science. Also I want admit that very soon I will be lieutenant.
So I'm “free man”. It's really cool :). Now I must think about my future life.