Hallo,
ich möchte den Usern einen Button in der Datenbank anbieten mit dem sie zwischen der lokalen und Server-DB wechseln können.
Sprich ein User hat seine lokale Replik geöffnet und möchte aber zur Server-Replik wechseln, dann sollte ein Klick auf den Button reichen, um die Lokale DB zu schließen und die Server-DB zu öffnen. Umgekehrt natürlich auch.
Ich habe im Moment das Problem , dass sich mit meinem Script die newDB nicht im Frontent öffnet, obwohl isopen auf true steht???
Was mache ich falsch?
Sub Click(Source As Button)
Dim s As New NotesSession
Dim uiws As New NotesUIWorkspace
Dim this_uidb As NotesUIDatabase
Dim server_default As String
Dim server_act As String
Dim RepID As String
Dim flag_ds As Boolean
Dim flag_rs As Boolean
Dim thisDB As NotesDatabase
Dim newDB As New NotesDatabase( "", "" )
Set thisDb = s.CurrentDatabase
Set this_uidb = uiws.CurrentDatabase
repID = thisDB.ReplicaID
server_act = thisDB.Server
server_default = s.GetEnvironmentString("MailServer",True)
If server_act = "" Then
If newDB.OpenByReplicaID( server_default, RepID ) Then
Print( newDB.Title & " Replik erfolgreich geöffnet" )
Else
Print( "Die Replik konnte nicht gefunden werden" )
End If
Else
If newDB.OpenByReplicaID( "", RepID ) Then
Print( newDB.Title & " Replik erfolgreich geöffnet" )
Else
Print( "Die Replik konnte nicht gefunden werden" )
End If
End If
End Sub
Grüße
Hitcher
Ok, noch eine Frage:
Call this_uidb.Close schließt die DB nicht, hat es damit zu tun, dass das Script innerhalb der DB ausgeführt wird?
Sub Click(Source As Button)
Dim s As New NotesSession
Dim uiws As New NotesUIWorkspace
Dim this_uidb As NotesUIDatabase
Dim server_default As String
Dim server_act As String
Dim RepID As String
Dim flag_ds As Boolean
Dim flag_rs As Boolean
Dim thisDB As NotesDatabase
Dim newDB As New NotesDatabase( "", "" )
Dim tmp As String
Set thisDb = s.CurrentDatabase
Set this_uidb = uiws.CurrentDatabase
repID = thisDB.ReplicaID
server_act = thisDB.Server
server_default = s.GetEnvironmentString("MailServer",True)
If server_act = "" Then
If newDB.OpenByReplicaID( server_default , RepID ) Then
Call uiws.OpenDatabase( server_default ,newDB.FilePath)
Print( "Server-Replik geöffnet" )
Call this_uidb.Close
Else
Print( "Die Replik konnte nicht gefunden werden" )
End If
Else
If newDB.OpenByReplicaID( "", RepID ) Then
Call uiws.OpenDatabase("",thisDB.FilePath)
Print( "Lokale-Replik geöffnet" )
Call this_uidb.Close
Else
Print( "Die Lokale-Replik konnte nicht gefunden werden" )
End If
End If
End Sub
Habs jetzt so und es wird immer noch nicht geschlossen.
Sub Click(Source As Button)
Dim s As New NotesSession
Dim uiws As New NotesUIWorkspace
Dim this_uidb As NotesUIDatabase
Dim server_default As String
Dim server_act As String
Dim RepID As String
Dim flag_ds As Boolean
Dim flag_rs As Boolean
Dim thisDB As NotesDatabase
Dim newDB As New NotesDatabase( "", "" )
Dim tmp As String
Set thisDb = s.CurrentDatabase
Set this_uidb = uiws.CurrentDatabase
repID = thisDB.ReplicaID
server_act = thisDB.Server
server_default = s.GetEnvironmentString("MailServer",True)
If server_act = "" Then
If newDB.OpenByReplicaID( server_default, RepID ) Then
Call this_uidb.Close
Call uiws.OpenDatabase( server_default,newDB.FilePath)
Print( "Server-Replik geöffnet" )
Else
Print( "Die Replik konnte nicht gefunden werden" )
End If
Else
If newDB.OpenByReplicaID( "", RepID ) Then
Call this_uidb.Close
Call uiws.OpenDatabase("",thisDB.FilePath)
Print( "Lokale-Replik geöffnet" )
Else
Print( "Die Lokale-Replik konnte nicht gefunden werden" )
End If
End If
End Sub
Ne ist es nicht - this_uidb
Set this_uidb = uiws.CurrentDatabase
wenn ich einen Button mit einem Script mache wo nur geschlossen werden soll gehts ???
Warum dann nicht im anderen Script?
Sub Click(Source As Button)
Dim s As New NotesSession
Dim uiws As New NotesUIWorkspace
Dim this_uidb As NotesUIDatabase
Dim server_default As String
Dim server_act As String
Dim RepID As String
Dim flag_ds As Boolean
Dim flag_rs As Boolean
Dim thisDB As NotesDatabase
Dim newDB As New NotesDatabase( "", "" )
Dim tmp As String
Set thisDb = s.CurrentDatabase
Set this_uidb = uiws.CurrentDatabase
Call this_uidb.Close
End Sub