I need some help or understanding on multiple loops. I understand the basic loop like below how you get your docs, create another doc and assign some values from doc to doc2.
Here is where I’m confused. I’m looking to a view for the docs. I get a the first doc. I next need to look at another view based on the first doc and loop that view for data and once all data is on the doc2, send doc2.
After the first doc is sent, go back to the first view and get the next doc, then grab the data from the 2nd view. Once all the data is on the doc2, send the docs in a message…
…on and on until doc is nothing on first view. Hopefully I didn’t get terminology mixed up that bad, forgive me there.
Looking to that second view to loop then going back to the first view is tricking me. Is this how inner/outter loops work?
Can someone help me understand this? Thanks.
Also, I read where it’s better to stay away from “Wend” or it’s won’t be around …so I figured that is not the best way.
Set doc2 = db.CreateDocument
'assign some values here…
'…
'…
'…
'…
'…
Set doc = collection.GetFirstDocument
Do Until doc Is Nothing
Set doc = collection.GetNextDocument(doc)
Loop
Subject: multiple loops
Well in a very much outline way this should workDim DocOne as NotesDocument
Dim DocTwo as NotesDocument
Dim NewDoc as NotesDocument
Dim ViewOne as NotesView
Dim ViewTwo as NotesView
Dim Col1 as NotesDocumentCollection
Dim Col2 as NotesDocumentCollection
'Open the views so they are properly defined
'Create Collection One
Set NewDoc = DB.CreateDocument
DocOne = Col1.GetFirstDocument
While !(DocOne is Nothing)
'Get Info from DocOne and Populate Col2
Set DocTwo = Col2.GetFirstDocument
While !(DocTwo is Nothing)
'Collect your data
Set Doc2 = Col2.GetnextDocument(DocTwo)
Loop
Set DocOne=Col1.GetNextDocument(DocOne)
Loop ’
You will have to add your logic to this.
Subject: You will have to add your logic to this.=>You will have to learn about algorithmics… lol
Subject: multiple loops
Loyd,
If your first doc has some data that is specific to your second view doc then you should look at getDocumentByKey to grab your second doc based on the key in the first doc.
Otherwise the approach you have is fine.
Shawn
Subject: RE: multiple loops
Yes, once I get the first doc in viewone, I need to get 2 values and based off those 2 values switch to viewtwo, select certain docs, grab a few field values off each doc, then create doctwo with all the info, then send…wow!
Still trying to figure out what is the best method for this…thanks!