Domino 9 und frühere Versionen > Entwicklung

Array aus werten einer DokumentKollektion bilden

(1/2) > >>

geissbock:
 ???
Hallo,
wie bekomme ich einen Array als string aus einer DokumentKollektion ausgelesen. Also ich bilde mir eine Dokumentkollektion und möchte nun die Werte aus einem bestimmten Feld (Mailadresse) von allen Dokumenten in einen String schreiben, damit ich denen mit Doc.Send dann ein Mail schreiben kann. Steh irgendwie aufem Kriegsfuß mit den Arrays. Bekomm das nicht hin und die Designer-Hilfe hat mir auch nicht besonders weitergeholfen.
Danke schon mal

Rob Green:
laut Help:

Examples: AppendToTextList method  

  1.   This script appends the text value "Shocks" to the Categories item in a document. For example, if the Categories item contains the values "Clocks" and "Blocks" before the script runs, it contains the values "Clocks," "Blocks," and "Shocks" after the script runs.
Dim doc As NotesDocument
Dim item As NotesItem
' ...set value of doc...
Set item = doc.GetFirstItem( "Categories" )
Call item.AppendToTextList( "Shocks" )
Call doc.Save( False, True )
  2.   This script appends three new text values to the Categories item in a document: "Girls," "Boys," and "Toys."
Dim doc As NotesDocument
Dim item As NotesItem
Dim newVals( 1 To 3 ) As String
'...set value of doc...
Set item = doc.GetFirstItem( "Categories" )
newVals( 1 ) = "Girls"
newVals( 2 ) = "Boys"
newVals( 3 ) = "Toys"
Call item.AppendToTextList( newVals )
Call doc.Save( False, True )
  3.   This script copies all of the Categories values from document A onto document B. For example, if the Categories item on document A contains "Tool" and "Weapon" and the Categories item on document B contains "Technology," then after the script runs the Categories item on document B contains three values: "Tool," "Weapon," and "Technology." Document A is unchanged.
Dim docA As NotesDocument
Dim docB As NotesDocument
Dim item As NotesItem
'...set values of docA and docB...
Set item = docB.GetFirstItem( "Categories" )
Call item.AppendToTextList( docA.Categories )
Call docB.Save( False, True )

ata:
... ich würde den Weg über ein reguläres Array gehen, dann erhälst du wenigstens eine Fehlermeldung, wenn du die 32K des Feldes sprengst. Bei Rob's ansatz wird das Feld dann einfach aus dem Dokument gelöscht - ohne Meldung - BUG !!!

... sicherer ist der Weg über ein Array zu gehen, etwa in der Art

' # ...
Dim doc As NotesDocument
Dim dc As NotesDocumentCollection
Dim sArray() As String
Dim c as long
' # ... alle Variablen wurden bereits initialisiert...

c = -1
Set doc = dc.GetFirstDocument
While Not doc Is Nothing
   c = c + 1
   Redim Preserve sArray(0 to c)
   sArray(c) = doc.MailAddress(0)
   Set doc = dc.GetNextDocument(doc)
Wend

deinZuVersendendesDoc.SendTo = sArray
' # ...

ata

geissbock:
 ;D
Danke Ata,
das funzt super. Jetzt hab ich noch das problem, daß da Dubletten drin sind die ich gern eleminieren würde. Hab's mal auf die einfache tour mit umlArray=Evaluate("@Unique(sArray)",doc2) versucht, aber klappt nicht.
Haste auch noch ne Idee dafür, dem SkriptNewbie zuliebe.
Danke

ata:
... schau mal hier:

http://www.atnotes.de/index.php?board=7;action=display;threadid=6635

ata

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln