Das Notes Forum

Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: shizen am 26.01.04 - 15:25:10

Titel: alle inhalte eines Feldes auslesen
Beitrag von: shizen am 26.01.04 - 15:25:10
Hallo

ich kann mit doc.feld(0) auf das erste Element eines Feldes zu greifen, wie krieg ich raus ob es noch mehr gibt (Namensliste) und wie viele?
so das ich ne schleiefe drüber machen kann

Danke
Titel: Re:alle inhalte eines Feldes auslesen
Beitrag von: Axel am 26.01.04 - 15:26:42
Hi,

versuch' mal so:


For i = 0 To Ubound(doc.Feld)
  Messagebox doc.Feld(i)
Next


Axel
Titel: Re:alle inhalte eines Feldes auslesen
Beitrag von: shizen am 26.01.04 - 15:46:44
Danke, wusste gar nicht das das auf Feldern funktioniert!!
werden Felder denn als normale Variablen angesprochen

Grüße
Titel: Re:alle inhalte eines Feldes auslesen
Beitrag von: Glombi am 26.01.04 - 15:54:59
Felder werden intern als Arrays verwaltet (nun ja, meistens - bis auf Rich Text )

Was meinst Du denn mit Variablen?

doc.Feld ist übrigens die sog. "Extended Class Syntax"
eigentlich muesste es so heißen: doc.GetItemValue("Feld")

Andreas

P.S.: Performance-Fanatiker verwenden niemals die Extended Class Syntax
Titel: Re:alle inhalte eines Feldes auslesen
Beitrag von: Axel am 26.01.04 - 15:58:21
Hi,

du sprichst das Feld nicht als Variable an, sondern du arbeitest mit dem Rückgabewert.

Ein Blick in die Designer-Hilfe zeigt folgendes:

Auszug zu GetItemValue aus der Klasse NotesDocument
Zitat

...

Usage
For text, number, and time-date items, GetItemValue always returns an array, even when there is only a single value in the item. If you know the item contains only a single value, access the first element in the array, which is at index 0. If you know the item contains multiple values, but you don't know how many, iterate over the array elements using the Forall statement.

"Extended class" syntax
You can also access the contents of an item directly, without using GetItemValue. The following two statements are equivalent:

t = lastDoc.GetItemValue( "Topic" )
t = lastDoc.Topic

This syntax lets you access and modify items the same way you access and modify other NotesDocument properties. The return value is the same, that is, an array of values for text, number, or time-date items, and a string for rich text items.
...

Du kannst nun folgendes machen:

t = lastDoc.Topic
For i = 0 to Ubound(t)
...

Aber das Ganze geht dann auch kürzer:

For i = 0 to Ubound(lastdoc.Topic)
...


Axel