Domino 9 und frühere Versionen > ND7: Entwicklung
Verständnisfrage: Building Databases Tutorial
ascabg:
Hallo,
Was ist daran kompliziert.
Wenn Zaehler = 1, dann "Vorname" + "Nachname" in das Feld "FullName" geschrieben.
Wenn Zaehler > 1 dann wird der bereits vorhandene Inhalt des Feldes "FullName" um "Vorname" + "Nachname" erweitert.
Andreas
m3:
--- Zitat ---@If evaluates a condition; if the condition is True, Lotus Notes/Domino performs the action appearing immediately after that condition, and stops. If the condition is False, Lotus Notes/Domino skips to the next condition and tests it, and so on. If none of the conditions is True, Lotus Notes/Domino performs the else_action.
Syntax
@If( condition1 ; action1 ; condition2 ; action2 ; ... ; condition99 ; action99 ; else_action )
Parameters
condition
Expression that returns a Boolean. If this expression returns True, action is performed. If it's False, Lotus Notes/Domino skips to the next condition, if there is one. Otherwise, Lotus Notes/Domino performs else_action.
action
An action to be performed or a value to be returned if the governing condition returns True.
else_action
An action to be performed or a value to be returned if none of the conditions returns True.
Usage
In its simplest form, the If statement looks like this: @If( condition ; action ; else_action ).
You can list up to 99 conditions and corresponding actions, followed by just one action to be performed when all the conditions are False. As soon as a condition evaluates to True, Lotus Notes/Domino performs the associated action and ignores the remainder of the @If statement.
--- Ende Zitat ---
klaussal:
@Elements liefert die Anzahl der Einträge im Feld "Firstname", also 3.
Wenn n = 1 ist, setze jeweils den ersten Wert von Firstname und Lastname in das Feld Fullname.
Wenn n > 1, dann ergänze das Feld Fullname um First- und Lastname.
Die Schleife wird solange durchlaufen bis n > 3 ist.
Peter Klett:
If FirstName contains:
"John" : "Patty" : "Mary"
Um das Feld FirstName mit dem Inhalt zu versehen, schreibst Du
FIELD FirstName := "John" : "Patty" : "Mary"
Durch den Doppelpunkt werden die einzelnen Namen als neue Elemente in das Feld aufgenommen. Das Feld FirstName enthält also danach drei Einträge.
FirstName[1] ist "John", FirstName[2] ist "Patty" usw.
Folglich ist in einer Schleife, in der n die Zählvariable ist, FirstName[n] "John", wenn n = 1 ist.
In der Schleife wird das Feld FullName gefüllt, n ist die Zählvariable der Schleife.
FIELD FullName := @If(n=1;FirstName[n] + " " + LastName[n]; FullName : (FirstName[n] + " " + LastName[n]))
Ist n = 1 (n = 1 -> True), wird der blaue Teil ausgeführt (also Fullname mit Vor- und Nachnamen des jeweils ersten Eintrags gefüllt)
Ist n > 1 (n = 1 -> False), wird der grüne Teil ausgeführt (also Vor- und Nachnamen des jeweils n-ten Eintrages als neues Element an Fullname angehängt (wie oben bei FirstName, mittels Doppelpunkt))
yabo:
--- Zitat von: Peter Klett am 21.03.11 - 15:24:08 ---
--- Ende Zitat ---
Jaa, super! Jetzt habe ich es auch begriffen! ;D
Ich wusste gar nicht, dass man Werte in Feldern abspeichern kann. Im bisherigen Tutorial kamen sie nur als Auswahl- und Eingabefelder vor.
Ich hielt "FirstName" und co. für Variablen und war verwirrt, dass sich dort mehrere Werte abspeichern lassen.
Zu meiner Verteidigung muss ich aber auch sagen, dass das vorher nie erwähnt wurde. Auch nicht im Kapitel über Felder.
Danke nochmal, ihr habt mir den Tag gerettet. ;)
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln