Das Notes Forum
Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: wuwu am 03.03.05 - 14:00:43
-
Hallo,
ich habe hier im Forum und in der Hilfe gesucht, leider nicht fündig geworden:
Ich durchlaufe eine Ansicht, GetAllDocuemntsbyKEY usw.
While Not(v_doc Is Nothing)
var = var & v_doc.work_plan_follow_nr(0) & Chr(10)
Set v_doc =dc.GetNextDocument(v_doc)
Wend
Messagebox var
Hier gibt er mir 3 Werte in der Messagebox aus: 10, 20, 30, untereinander aufgelistet.
Ich schaffe es nicht, das er mir den größten(maximum) Wert des Feldes work_plan_follow_nr(0) ausgibt, also nur 30! Wie geht das?
Danke, mfg horst
-
Hallo
lngMaxWert = 0
while not( doc is Nothing )
if doc.work_plan_follow_nr( 0 ) > lngMaxWert Then
lngMaxWert = doc.work_plan_follow_nr( 0 )
end if
wend
msgbox cstr( lngMaxWert )
Ich denke es müsste so gehen.
Dirk
-
Da war jemand schneller :-)
Hi
1. ist das Feld work_plan_follow_nr ein Mehrfachfeld?
ansonsten könntest Du mit ungefähr wie folgt verfahren
dim max as integer
dim value as integer
max = 0
while ()
value = cint(v_doc.getitemvalue("Work_Plan_Follow_NR")(0))
if value>max then
max = value
end if
wend
messagebox cstr(max)
-
Hallo,
danke für eure Hilfe, ein Problem habe ich noch, er läuft mir jetzt in eine Endlosschleife, warum?
Sub Click(Source As Button)
On Error Goto haendler
Dim session As New NotesSession
Dim db As notesdatabase
Set db = session.CurrentDatabase
Dim dc As NotesDocumentCollection
Dim view As NotesView
Dim v_doc As NotesDocument
Dim ws As New NotesUIWorkspace
Dim uidoc As notesuidocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set view = db.GetView("$pm_work_plan")
Set dc = view.GetAllDocumentsByKey(doc.ParentDocumentUNID)
Set v_doc = dc.GetFirstDocument
Dim max As Integer
Dim value As Integer
max = 0
While Not(v_doc Is Nothing)
value = Cint(v_doc.getitemvalue("Work_Plan_Follow_NR")(0))
If value>max Then
max = value
End If
Wend
Messagebox Cstr(max)
Exit Sub
haendler:
Msgbox Error() & " / Zeile: " & Erl() & " (Modul:QuerySave)"
Exit Sub
End Sub
-
Weil Du das erste instantiierte Doc immer wieder in der While Wend-Schleife verwendest ;D
-
Hallo,
das ist die Lösung, ich bin heute schon zu lange davor gesitzt!
Danke nochmals für eure Hilfe!!
lngMaxWert = 0
While Not( v_doc Is Nothing )
If v_doc.work_plan_follow_nr( 0 ) > lngMaxWert Then
lngMaxWert = v_doc.work_plan_follow_nr( 0 )
End If
Set v_doc =dc.GetNextDocument(v_doc)
Wend
Msgbox Cstr( lngMaxWert )