Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: geissbock am 05.03.03 - 13:23:15
-
???
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
-
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 )
-
... 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
-
;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
-
... schau mal hier:
http://www.atnotes.de/index.php?board=7;action=display;threadid=6635 (http://www.atnotes.de/index.php?board=7;action=display;threadid=6635)
ata
-
???
Ja supi, das passt.
Und jetzt will ich noch zusätzlich den ermittelten wert in ein neues Dokument in einer Datenbank reinschreiben, aber das funktioniert auch nicht. Hängt wohl mit der Verquickung von uidoc und doc zusammen. Noch ne Idee wie das geht. Habs so versucht aber da meckert er:
Set uidoc = workspace.ComposeDocument _
( "/Server/", "db", "form" )
Call uidoc.FieldSetText("empfsent",sArray)
Call uidoc.save
Call uidoc.close
-
... ich würde über das Backend arbeiten, dann kannst du Arrays in ein Feld schieben, mit uidoc.FieldSetText gibts da Probleme wie du siehst...
Dim session as New NotesSession
Dim docNew As NotesDocument
Set db = session.GetDatabase( sServer , sDBName)
Set docNew = db.CreateDocument
docNew.Feldname = Array
docNew.Form = "Dein_Maskenname_mit_dem_gezeigt_werden_soll"
docNew.Save(True, True)
ata