Domino 9 und frühere Versionen > ND8: Entwicklung

eine Wert beim Dokumentöffnen berechnen lassen und anzeigen !

<< < (3/3)

Scotty67:
...ich habs !

danke - eure vielen aussagen "und wo bitte ist das problem..."  ;D haben mich beflügelt  ;D

ich lass den script im Queryopen - hab ein hidden field hinterlegt - welches wiederum für ein "computed for display" field
dient - am ende meines scripts wird genau diesen hidden field befüllt (temporär - also nicht gespeichert)

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
   
   Dim workspace As New NotesUIWorkspace
   Dim session As New NotesSession
   Dim doc As NotesDocument
   Dim SMdoc As NotesDocument
   Dim uidoc As NotesUIDocument
   Dim db As NotesDatabase
   Dim view As NotesView
   Dim dc As NotesDocumentCollection
   Set db = session.CurrentDatabase
   Dim Nummer As Variant
   Dim smdoingtime As Long
   Set view = db.GetView( "SMDoingTime" )
   Set doc=source.document
   Nummer = doc.GetItemValue( "SMnummer" )
   
   'Set dc = view.GetAllDocumentsByKey(Nummer(0), False)
   Set dc = view.GetAllDocumentsByKey("200000", False)
   Set SMdoc = dc.GetFirstDocument
   
   Do While Not(SMdoc Is Nothing)
      CalcUsedSMDoingTime=SMdoc.GetItemValue("UsedTime")
      
      If Cint(CalcUsedSMDoingTime(0)) = 0 Then
         Goto loopweiter
      Else
         smdoingtime=smdoingtime+Cint(CalcUsedSMDoingTime(0))      
      End If
loopweiter:
      Set SMdoc = dc.GetNextDocument(SMdoc)
   Loop
   
   Dim item As NotesItem
   Set item = doc.ReplaceItemValue( "collectedTime", smdoingtime )
   
End Sub

Thomas Schulte:
Und in der Formelsprache ist das ein Einzeiler.

@Sum(@ToNumber(@DbLookup( "" : "Nocache" ; "" : "" ; "SMDoingTime" ; Nummer ; "CalcUsedSMDoingTime" ; [FAILSILENT] )))

Peter Klett:
Genau! (@DBColumn von mir war Quatsch, musste natürlich @DBLookup heißen.) Das ist mit Sicherheit auch deutlich performanter.

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln