Domino 9 und frühere Versionen > ND6: Entwicklung
"Set db" anhand der ReplicaID
Glombi:
Kann es sein, dass die gleiche Datenbank mehrfach in CGdoc vorkommt?
Falls ja, kannst Du Dir bspw. den letzten Wert für die Repl ID merken:
Sub Click(Source As Button)
Dim s As New NotesSession
Dim directory As NotesDbDirectory
Dim db As New NotesDatabase("","")
Dim repID As String
Dim repID_alt As String
Dim server As String
Dim datei As String
Dim eval, alterString, neuerString As String
Dim CGdb As NotesDatabase
Dim CGview As NotesView
Dim CGdoc As NotesDocument
Set CGdb = s.CurrentDatabase
Set CGview = CGdb.GetView("0. Corporate Desktop(s) Categorized")
Set CGdoc = CGview.getfirstdocument
alterString = ":"
neuerString = ""
repID_alt = ""
While Not(CGdoc Is Nothing)
If CGdoc.form(0) = "f_database_icon" And CGdoc.k_db_type(0) = "spec" Then
server = CGdoc. t_db_server(0)
repID = CGdoc.t_db_replica_id(0)
eval = Replace(repID, ":", "")
repID = eval(0)
if repID_alt <> repID then
Call db.OpenByReplicaID(server , repID)
end if
Print db.Title
repID_alt = repID
End If
Set CGdoc = CGview.getnextdocument(CGdoc)
Wend
End Sub
Tipp:
Dim eval, alterString, neuerString As String
macht man nicht, sonderm
Dim eval as variant
dim alterString as string, neuerString As String
Andreas
Hedwig14:
hallo Andreas,
vielen Dank für Deinen Hinweis. Die Idee ist nicht schlecht.
Leider bleibt der Fehler bestehen: This database object is already open .....
(Sie ist auch durch definitiv User im Gebarauch)
Dim s As New NotesSession
Dim directory As NotesDbDirectory
Dim db As New NotesDatabase("","")
Dim repID As String
Dim server As String
Dim datei As String
Dim eval As String
Dim alterString As String, neuerString As String, repID_alt As String
Dim CGdb As NotesDatabase
Dim CGview As NotesView
Dim CGdoc As NotesDocument
Set CGdb = s.CurrentDatabase
Set CGview = CGdb.GetView("0. Corporate Desktop(s) Categorized")
Set CGdoc = CGview.getfirstdocument
alterString = ":"
neuerString = ""
repID_alt = ""
While Not(CGdoc Is Nothing)
If CGdoc.form(0) = "f_database_icon" And CGdoc.k_db_type(0) = "spec" Then
server = CGdoc. t_db_server(0)
repID = CGdoc.t_db_replica_id(0)
If server = "%INI%ICODEX_CD_SPK_APPLSERVER" Then
server = "S276LN22/SPKHolstein/DE"
End If
eval = Replace(repID, ":", "")
repID = eval
If repID_alt <> repID Then
Call db.OpenByReplicaID(server , repID)
End If
Print db.Title
repID_alt = repID
'Textdatei erstellen
Datei = "d:\cg.txt"
Open datei For Append Access Write As #1
Print #1, Cstr(db.Title) & " " & repID
Close #1
End If
Set CGdoc = CGview.getnextdocument(CGdoc)
Wend
m3:
OpenByReplicaID liefert sogar einen Rückgabewert - wie wärs wenn Du den abfängst und entsprechend reagierst, anstatt diesen mit "Call" einfach zu ignorieren?
koehlerbv:
Eine weitere Ignoranz ist dies:
--- Code: --- If server = "%INI%ICODEX_CD_SPK_APPLSERVER" Then
server = "S276LN22/SPKHolstein/DE"
--- Ende Code ---
Und wenn nicht? Das wird dann ein unkontrollierbarer Zustand.
Bernhard
Hedwig14:
so habe ich es schon probiert, es kommt leider die selbe meldung:
If db.OpenByReplicaID( server , repID ) Then
Print db.Title
End If
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln