Domino 9 und frühere Versionen > ND8: Entwicklung

bestimmte ansicht im hintergrund öffnen...............

(1/1)

Vigeli:
hallo leute

brauche eure hilfeeeeee!!!!

möchte eine bestimmte ansicht via agent im hintergrund öffnen...............dann prüfen ob im feld FELD1 wert WG1 drin steht ....wen dies so ist sollte anschliessend andere feld mit FELD2 mit werten aus feld WERT1 gefühlt werden.....und nacher alles speichern

gibt es ein script (bespiel) hierfür?

besten dank

WernerMo:
Hallo,

muss es script sein, in Formel wäre das ein Fall für "@DBLookup".

Gruß Werner

Vigeli:
....ja am liebsten ein script.....sollte wen möglich als agent mehrmals täglich laufen

WernerMo:
Hallo,

nochmal ganz von vorne, Du willst einen periodischen Agenten machen, der alle Dokumente einer bestimmten Ansicht durchgeht und dann in jedem Dokument Felder ändert?

Evtl. in der DesignerHilfe NotesDocumentCollection
oder
http://atnotes.de/index.php?topic=41924.msg268775#msg268775

Gruß Werner

flaite:
Habs nicht getestet, könnte aber klappen

--- Code: ---Sub Initialize
On Error Goto Fehler
Dim s As New notessession
Dim db As NotesDatabase
Dim vw As NotesView
Dim col As NotesDocumentCollection
Dim doc As NotesDocument

Dim searchVal As String
Dim index As Variant

        dim counter as long

searchVal = "WG1"
counter = 0
Set db = s.currentDatabase
Set vw = db.getView("HIER_DEN_VIEW_NAMEN_REINSCHRIBEN")
Set col = vw.getAllDocumentsByKey("RandomKey den es bestimmt nicht gibt") ' diese Zeile nicht ändern :-)

Set doc = vw.getFirstDocument()
Do Until doc Is Nothing
col.addDocument doc
Set doc = vw.getNextDocument(doc)
Loop

Set doc = col.getFirstDocument
Do Until doc Is Nothing
index = Arraygetindex(doc.getItemValue("Feld1"), searchVal)
If index <> Null Then
doc.replaceItemValue "Feld2", doc.getItemValue("Feld1")
doc.save True, False
                        counter = counter + 1

End If
Set doc = col.getNextDocument(doc)
Loop
msgbox Cstr(counter) & " documents have been changed by this friendly agent."
Ende:
Exit Sub
Fehler:
Msgbox "Fehler -> " & Error$ & "(" & Cstr(Err) & ") in Zeile: " & Cstr(Erl)
Resume ende
End Sub

--- Ende Code ---

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln