I know how to get a list from DB in different server, but how to replace a list in dB in another server in LS? Any idea?
Subject: If the list is in a field, perhaps this will get you started.
It will need some clean up…and a While Not statement, etc.
Dim session As New notessession
Dim db As NotesDatabase
Dim view As notesview
Dim item As notesitem
Dim db2 As New notesdatabase("servername", "develop/teststuff3.nsf")
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim owner As notesitem
Set db = session.CurrentDatabase
Set db2 = New notesdatabase("servername", "develop/teststuff3.nsf")
If db2.IsOpen Then
' Messagebox "Title: " & db2.Title & Chr(10) & "Is open" , , _
' "File name: " & db2.FileName
'Else
' Messagebox "Not open", , "File name: " & db2.FileName
Set view = db2.GetView("All Docs")
Set doc = view.GetFirstDocument
Set item = doc.replaceitemvalue ("field1", "It worked")
Call doc.Save(False, True)
Subject: RE: How do I replace a list in another DB in different server?
A list in a database can mean so many different things. Can you please be more specific?
Subject: RE: How do I replace a list in another DB in different server?
sorry for that. I mean get a name list from DB2.nsf in serverName. and replace a name list in DB3.nsf in ServerName2. I know how to get a name list from DB2.nsf, but do not know how to replace a old name list in DB3.nsf in ServerName3.
Subject: RE: How do I replace a list in another DB in different server?
A list in a database can mean so many different things. Can you please be more specific?
For instance, can you tell us whether the list is stored [1] in a multivalued field in a profile document, [2] in a multivalued field in a regular document, or whether [3] one list value is stored in each document in a view, so that you are really reading a column from the view and that is your list, or [4] something else?
Which programming language do you prefer to use?
Do you have a preference for how the list will be stored in the destination database? Does it have to be stored the same way as in the source, or do you not care as long as it’s usable for your intended purpose? What is your intended purpose? Is it a keyword list? Can you tell us how long the list is likely to get? Is it the same for each user? Why do you need to copy the list instead of just using it in its original database?
Subject: I cleaned up the code…replace servername with your server and view name.,
Dim session As New notessession Dim db As NotesDatabase
Dim view As notesview
Dim item As notesitem
Dim db2 As New notesdatabase("servername", "develop/teststuff3.nsf")
Dim dc As NotesDocumentCollection
Dim doc, Nextdoc As NotesDocument
Dim owner As notesitem
Set db = session.CurrentDatabase
Set db2 = New notesdatabase("servername", "develop/teststuff3.nsf")
If db2.IsOpen Then
Set view = db2.GetView("All Docs")
Set doc = view.GetFirstDocument
While Not (doc Is Nothing)
Set Nextdoc = view.getnextdocument(doc)
Set item = doc.replaceitemvalue ("field1", "try this")
Call doc.Save(False, True)
Set doc= Nextdoc
Wend
End If
Subject: How do I replace a list in another DB in different server?
If you are working in Notes client here how you can do it.
-
Create a hidden field (let’s call them “tempdblist”) make sure “Allow mutiple values” option is check.
-
I have created a Dialog list where I have list of server names (let’s call this “serverlist”).
-
I have created a Dialog list (let’s call it “dblist”).
-
In serverlist “Exiting” method I have written this Script to get the list of db names from the selected server.
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim servername As String
Dim strdblist As String
Set uidoc = ws.CurrentDocument
servername = uidoc.FieldGetText(“serverlist”)
If (servername = “Local”) Then
servername = ""End If
Dim dbdir As New NotesDbDirectory(servername)
Dim db As NotesDatabase
Dim flag As Integer
flag = False
Set db = dbdir.GetFirstDatabase(DATABASE)
While Not(db Is Nothing)
strdblist = strdblist + db.FilePath + ";" Set db = dbdir.GetNextDatabaseWend
Call uidoc.FieldSetText(“tempdblist”, strdblist)
Call uidoc.Refresh