Domino 9 und frühere Versionen > ND7: Entwicklung

Frage zu einer Schleife

<< < (2/2)

koehlerbv:

--- Zitat von: Bruce Willis am 04.02.09 - 20:54:55 ---Wie würdest Du etwas ähnliches (egal was) FLEXIBEL realisieren?  :)
--- Ende Zitat ---

Egal was? Anbei ein Code Snippet, welches n * 3 Felder einer Maske im Frontend durchgeht und zwar keine History schreibt, aber leere Felder zwischen Feld n(x1) bis n(x3) und n+1(x1) und n+1(x3) entfernt. Das Prinzip ist aber genau identisch:


--- Zitat ---   For iCounter = 1 To (iMaxLines - 1)
      If uidocCurrent.FieldGetText ("SkillBez" & Cstr (iCounter)) = "" Then
         'Copy each following line to the line before:
         For iCounter2 = iCounter To (MaxLine - 1)
            Call uidocCurrent.FieldSetText ("SkillBez" & Cstr (iCounter2), uidocCurrent.FieldGetText ("SkillBez" & Cstr (iCounter2 + 1)))
            Call uidocCurrent.FieldSetText ("SkillNote" & Cstr (iCounter2), uidocCurrent.FieldGetText ("SkillNote" & Cstr (iCounter2 + 1)))
            Call uidocCurrent.FieldSetText ("SkillBem" & Cstr (iCounter2), uidocCurrent.FieldGetText ("SkillBem" & Cstr (iCounter2 + 1)))
         Next
         'Delete the last line:
         Call uidocCurrent.FieldSetText ("SkillBez" & Cstr (MaxLine), "")
         Call uidocCurrent.FieldSetText ("SkillNote" & Cstr (MaxLine), "")
         Call uidocCurrent.FieldSetText ("SkillBem" & Cstr (MaxLine), "")
         
         '... and check this line again - maybe, the next line was empty, too:
         iLoops = iLoops + 1
         If iLoops < iMaxLines Then
            iCounter = iCounter - 1
         End If
      End If
   Next

--- Ende Zitat ---

Ich habe das vor ca. acht oder neun Jahren geschrieben und würde heute auch den "inneren Teil" durch eine Schleife ersetzen, aber ich denke, so kannst Du noch besser das Prinzip erkennen.
Also: Genau 20 Zeilen, um (in diesem Fall) 150 Felder im Frontend aufzuräumen (wobei das bei 5000 Feldern immer noch diese 20 Zeilen wären).

HTH,
Bernhard

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln