Domino 9 und frühere Versionen > Entwicklung

Felder automatisch anlegen

<< < (3/3)

Glombi:
Ich würde die Felder mit einen Index als Suffix versehen, also bspw.

Mitarbeiter_1        Antwort_1
Mitarbeiter_2        Antwort_2
... ... ...
Mitarbeiter_20      Antwort_20

Du markierst die Mitarbeiter in der View und klickst dann auf den Button. Der Button ist in Script programmiert.

Die gewählten Dokumente bekommst Du als Collection. Darüber dann iteriere

dim ... das übliche...
dim dc as NotesDocumentCollection
dim i as integer

set ... das übliche
set dc = db.UnprocessedDocument

... set doc ... irgendwie beschaffen

set dcdoc = dc.GetFirstDocument

for i = 1 to dc.Count
doc.ReplaceItemvalue("Mitarbeiter_" & cstr(i), dcdoc.Name(0) )
next

set dcdoc = dc.GetDocDocument(dcdoc)


Die Verbergenformel für die beiden Felder in Zeile i müssten dann lauten: Verbergen wenn Formel wahr =
Mitarbeiter_i = ""

Andreas

chock:
Habe jetzt mal so gemacht. In der Maske mit der Tabelle einen Button mit folgendem Script angelegt.


Dim session As New NotesSession
   Dim ws As New NotesUIWorkspace
   Dim db As NotesDatabase
   Dim view As NotesView
   Dim doc As NotesDocument
   Dim uidoc As NotesUIDocument
   Dim aktdoc As NotesDocument
   Dim tmp,tmp1 As Variant
   
   Set db = session.CurrentDatabase
   Set view = db.GetView("Mitarbeiter")
   Set uidoc = ws.currentdocument
   Set aktdoc = uidoc.document
   tmp = aktdoc.GetItemValue("t_abt")
   
   Set doc = view.GetFirstDocument
   While Not(doc Is Nothing)
      tmp1=doc.GetItemValue("abteilung")
      If (tmp(0) = tmp1(0))  Then   
         aktdoc.t1=doc.n_name(0) + " " + doc.v_name(0)
      End If
      Set doc = view.GetNextDocument(doc)
   Wend

aktdoc.t1 ist die erste Tabellenzeile.Die Felder in der Tabelle gehen bis t20.
Muss ich jetzt jedes feld angeben, oder kann ich dies automatisieren, das er wenn Feld t1 gefüllt ist ins Feld t2 springt usw?

Gandhi:
kannst Du automatisieren:
...
dim feldname as string
for i=1 to....
feldname="hallo_"&str(i)
call doc.replaceitemvalue(feldname,wert)
...

Glombi:
Ich hatte es bereits in meinem Codefragment so:

doc.ReplaceItemvalue("t_" & cstr(i), doc.n_name(0) + " " + doc.v_name(0)
)

Dim session As New NotesSession
   Dim ws As New NotesUIWorkspace
   Dim db As NotesDatabase
   Dim view As NotesView
   Dim doc As NotesDocument
   Dim uidoc As NotesUIDocument
   Dim aktdoc As NotesDocument
   Dim tmp,tmp1 As Variant
dim i as integer
   
   Set db = session.CurrentDatabase
   Set view = db.GetView("Mitarbeiter")
   Set uidoc = ws.currentdocument
   Set aktdoc = uidoc.document
   tmp = aktdoc.GetItemValue("t_abt")
   
   Set doc = view.GetFirstDocument
i = 1
   While Not(doc Is Nothing)
      tmp1=doc.GetItemValue("abteilung")
      If (tmp(0) = tmp1(0))  Then  
         call aktdoc.ReplaceItemValue("t" &cstr(i),doc.n_name(0) + " " + doc.v_name(0))
      End If
      Set doc = view.GetNextDocument(doc)
i = i + 1
   Wend



Andreas

chock:
Danke für die schnelle Hilfe

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln