Domino 9 und frühere Versionen > ND7: Entwicklung

UnprocessedDocument im Web

(1/2) > >>

snoopy_777:
Hallo!

Ich steh schon wieder an  :-[

Ich hab eine in $$ViewTemplateDefault eingebettete View im Web, bei der man Dokumente auswählen kann.
In den selektierten Dokumenten will ich den Wert eines Feldes setzen.

Ich hab einen Button, der einen Agent aufruft der das machen soll.
Fehler bekomm ich keinen, aber ich hab mir die Anzahl der Dokumente ausgeben lassen, und die ist null  ???
Geht UnprocessedDocuments nicht im Web?

Hier der Source des Agenten:

--- Code: ---Sub Initialize

Dim s As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim configView As NotesView
Dim configdoc As NotesDocument
Dim Comment1 As String
Dim Comment2 As String

Dim i As Integer

On Error Goto errHandle

Set db = s.CurrentDatabase

' read Configurationdocument to get Standardcomments
Set configView = db.GetView("($IndexConfiguration)")
Call configView.Refresh()
Set configDoc = configView.getFirstDocument

Comment1 = GetStandardComment1(configDoc)
Comment2 = GetStandardComment2(configDoc)

' Set Comment for selected Docs
Set collection = db.UnprocessedDocuments
Set doc = collection.GetFirstDocument()

i=0

While Not(doc Is Nothing)

i=i+1

If(doc.Flag(0) = "") Then
doc.Comment2(0) = Comment2
Else
doc.Comment1(0) = Comment1
End If

Call doc.Save( False, True )

Set doc = collection.GetNextDocument(doc)

Wend

Print{<h1>}
Print("Prozessed: " + Cstr(i))
Print{</h1>}

errHandle:

End Sub

--- Ende Code ---

Vielen vielen Dank - und schönen Feiertag!
lg
Alex

eknori:
m öglicherweise hilft das http://www.nsftools.com/tips/NotesTips.htm#unreaddocs weiter

m3:
@Ulrich: Julians Code ist, soweit ich das sehen konnte, nur für den Notes-Client gedacht.

Ich denke, dass diese Beispiele eher helfen können:
http://www.codestore.net/store.nsf/unid/EPSD-5GMT3B?OpenDocument
http://brefere.com/notesnet/processselectedwebdocs.pdf

snoopy_777:
Danke m3, das hat schon viel geholfen!!
Ich hab es ein wenig anders gemacht als im Sample, da ich den Agenten über Web starte, was auch einwandfrei funktioniert.
Allerdings hab ich jetzt Probleme das Feld im Agenten auszulesen. Irgendwie is das immer leer und beim Split haut es ihn dann auf.

Das is der Button in $$ViewTemplateDefault

--- Code: --- <input type="button" class="formAction" value="StdComment" target="_blank" onClick="InsertStandardComment()">

--- Ende Code ---

Hier der Javascript Teil der bei onClick aufgerufen wird.
TempString is ein verstecktes Feld das Text/Berechnet ist.

--- Code: ---function InsertStandardComment(){
// Url to start the agent
var url = window.document.getElementById("dbPath").value + "/InsertComment?openagent";
var urlReturn = window.document.getElementById("Path_Translated").value + "/?OpenForm";
if (window.document.applets[0]){
window.document.getElementById("tempString").value = window.document.applets[0].getSelectedDocumentsEx();
Check = confirm("You have selected " + window.document.getElementById("tempString").value.split(",").length + " document(s) for StandardComemnt, do you really want to continue?");
if (Check){
alert(window.document.getElementById("tempString").value);
window.document.forms[0].submit();
window.location=url;
//window.location=urlReturn;
}
}
}

--- Ende Code ---

Und hier der Agent:

--- Code: ---Sub Initialize

Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim ermComment As String
Dim trmComment As String
Dim docArray As Variant

On Error Goto errHandle

Set db = s.CurrentDatabase

ermComment = "ermcomment"
trmComment = "trmcomment"

' Set Comment for selected Docs
docArray = Split(viewDoc.tempString(0), ",")

Forall unid In docArray
Set doc = db.GetDocumentByUNID(unid)

If(doc.ErmTrmFlag(0) = "TRM") Then
doc.trmComment(0) = trmComment
Else
doc.ermComment(0) = ermComment
End If

Call doc.Save( False, True )

End Forall

Exit Sub

errHandle:
Exit Sub

End Sub

--- Ende Code ---

Ich glaub das das mit dem Speichern des $$ViewTemplateDefault irgendwie nicht richtig hinhaut???

Danke vielmals
Alex

Edit: Ach ja - hatte ich vergessen - im OnSubmit dieser Maske hab ich noch @Command([FileSave]) drinnen

umi:
ViewTemplates kannst Du nicht editieren im Web, bzw. lassen sich nicht speichern als Dokumente.

Wenn Du anstatt dem ViewTemplate, eine Eingebettete Ansicht verwendest sollte es funktionieren.

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln