Anzahl Dokumente abhängig vom Datum

  • Hallo zusammen,


    ich habe in einer Maske, die neben anderen Feldern noch die Feder N_Beginn1( Startdatum) und N_BEGINN3 (Endedatum ) . Wenn nun ein Benutzer


    N_Beginn1= 25.06.2018

    N_Beginn3= 28.06.2018


    eingibt, müssten eigentlich 4 Dokumente erstellt werden, die sich jeweils am N_Beginn3 Feld unterscheiden. N_Beginn1 und N_Beginn3 sind vom Typ Datumsfelder


    Irgendwie komme ich aber nicht weiter. Kann man das mit einer Do While Schleife überhaupt lösen ?


    Function termineintrag()


    Dim ws As New NotesuIWorkspace

    Dim uidoc As NotesUIDocument

    Set uidoc=ws.CurrentDocument


    quelldocdat=uidoc.FieldGetText("N_beginn1")

    quelldocdat3=uidoc.FieldGetText("N_beginn3")


    If quelldocdat <> quelldocdat3 Then


    Do While quelldocdat <> quelldocdat3

    quelldocdat=quelldocdat+1

    Call uidoc.Save

    Loop


    End If


    termineintrag=True

    End Function

  • Vielen Dank. Jetzt rechn Notes zumindest schon mal richtig. Was ich aber nicht verstehe, warum werden nicht mehrere Dokumente angelegt ?


    quelldocdat=uidoc.FieldGetText("N_beginn1")

    quelldocdat3=uidoc.FieldGetText("N_beginn3")


    tmpquelldocdat=Cdat(quelldocdat)

    tmpquelldocdat3=Cdat(quelldocdat3)


    If tmpquelldocdat <> tmpquelldocdat3 Then


    Do While tmpquelldocdat <> tmpquelldocdat3

    tmpquelldocdat=tmpquelldocdat+1

    Call uidoc.FieldSetText("N_Beginn1",Cstr(tmpquelldocdat))

    Call uidoc.Save

    Loop

    Else

    Call uidoc.Save

    End If

  • Weil du ja immer nur den Wert im aktuellen Dokument neu setzt und das Dokument speicherst


    Wenn du mehrere Dokumente angelegt haben willst, dann musst du auch neue Dokumente erstellen und nicht nur das aktuelle verändern

  • Hane das Script nun soweit angepasst, das in der Scheliefe mit "Set neutermin = New NotesDocument ( db )" ein neues Dokument erzeugt werden soll.

    Klappt leider nicht. Das Dokument wird auch gespeichert. Aber eben nur das eine. Woran kann das noch liegen ?


    Dim neutermin As NotesDocument


    quelldocdat=uidoc.FieldGetText("N_beginn1")

    quelldocdat3=uidoc.FieldGetText("N_beginn3")


    tmpquelldocdat=Cdat(quelldocdat)

    tmpquelldocdat3=Cdat(quelldocdat3)


    If tmpquelldocdat <> tmpquelldocdat3 Then


    Do While tmpquelldocdat = tmpquelldocdat3

    tmpquelldocdat=tmpquelldocdat+1

    Set neutermin = New NotesDocument ( db )

    neutermin.Form = "Termin"

    Call neutermin.ReplaceItemValue("N_Beginn",Cstr(tmpquelldocdat))

    Call neutermin.Save(False,False)

    Loop

    Else

    Call uidoc.Save

    End If

  • Code
    If tmpquelldocdat <> tmpquelldocdat3 Then
        Do While tmpquelldocdat = tmpquelldocdat3
            (...)
    
        Loop  
    
    (...)
    End If


    => Wenn die beiden Datumswerte unterschiedlich sind, iteriere über die Schleife, solange die Werte identisch sind? Bist du sicher, dass das so gewollt ist?

    Life is not a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming "Wow, what a ride!!! :evil:
    Beschleunigung ist, wenn die Tränen der Ergriffenheit waagrecht zum Ohr hin abfliessen - Walter Röhrl