How could I parse values into seperate fields using LotusScript?

HiI have the following code that dumps values into one field…ie. you select a family, it then displays related companies and then related mandates, at the moment it dumps the values into one field. I would like to dump each company selected into a seperate field as well as mandates…there could be up to 7 companies linked to a family with the equal amount of mandates??

Any advice appreciated.

Thanks in advance, see code below:

Sub Selections (doc As NotesDocument)

Dim w As New NotesUIWorkspace 

Dim s As New NotesSession

Dim AddView As NotesView

Dim DbPath As String

Dim ServerName As String

Dim ProductType As String

Dim Adoc As NotesDocument

Dim Bdoc As NotesDocument

Dim Cdoc As NotesDocument

Dim db As NotesDatabase

Dim TempAddress As String

Dim TempAddress2 As String

Dim uidoc As notesuidocument

Dim PickCollection1 As NotesDocumentCollection

Dim PickCollection2 As NotesDocumentCollection

Dim PickCollection3 As NotesDocumentCollection

Dim ProfileDoc As NotesDocument

Dim IENLeadsEnabled

Dim tempstring As String

Dim tempstring1 As String



Set db = s.CurrentDatabase

Set ProfileDoc = ExtensionsProfile(db)



IENLeadsEnabled = ProfileDoc.IENLeadsEnabled(0)



Dim IENAddressesDbFound As Variant

Call IENGetProfilePathFrontEnd(ServerName, DbPath, IENAddressesDbFound)

If	IENAddressesDbFound = False Then Exit Sub

Dim AddDb As New NotesDatabase(ServerName,DBPath + "IENAddresses.nsf")

Dim ItemDb As New NotesDatabase(ServerName,DBPath + "IENItems.nsf")



Dim OrgView As NotesView

Dim OrgColl As NotesDocumentCollection

'get list of client families

pText = "Select Client Family"

wTitle = "Select"

Set PickCollection1 = w.PickListCollection(PICKLIST_CUSTOM, False , ServerName, DBPath + "IENAddresses", "(ClientFamilies)", wTitle, pText)

Set Adoc = PickCollection1.GetFirstDocument

If Not (Adoc Is Nothing) Then

	'tempstring = ""

'get list of companies under client family

	'tempstring = doc.IENCompany(0)			

	'doc.IENCompany = tempstring + adoc.IENCompany(0)

	'doc.IENAssOrg = "Yes"

	'Call doc.save(False,False)

	Set OrgView=AddDb.GetView("(Parent)")

	Set OrgColl=OrgView.GetAlldocumentsByKey(Adoc.IENCompanyDocumentUniqueID(0),True)

	If OrgColl.count>0 Then

		pText = "Select Companies within "

		wTitle = "Select"

		Set PickCollection2 = w.PickListCollection(PICKLIST_CUSTOM, True , ServerName, DBPath + "IENAddresses", "(Parent)", wTitle, pText + adoc.CompanyName(0),Adoc.IENCompanyDocumentUniqueID(0))

		Set bdoc = pickcollection2.GetFirstDocument

	End If

	Do While Not (Bdoc Is Nothing) 

		tempstring = ""	

'run through companies and get their mandates one company at a time

		tempstring = doc.FamilyCompanies(0)	

		doc.FamilyCompanies = tempstring + "; " + bdoc.ienviewfullname(0)

		Call doc.save(False, False)	

		Set OrgView=ItemDb.GetView("(OrgMandate)")

		Set OrgColl=OrgView.GetAlldocumentsByKey(bdoc.IENCompanyDocumentUniqueID(0),True)

		If OrgColl.count>0 Then

			pText = "Select Mandates of "

			wTitle = "Select"

			Set PickCollection3 = w.PickListCollection(PICKLIST_CUSTOM, True , ServerName, DBPath + "IENItems", "(OrgMandate)", wTitle, pText + bdoc.CompanyName(0),bdoc.IENCompanyDocumentUniqueID(0))

			Set cdoc = pickcollection3.GetFirstDocument				

			

		End If			

		

		Do While Not (cdoc Is Nothing)

			tempstring = ""

			'*****each mandate can be worked on here

			tempstring = doc.CompanyMandates(0)						

			doc.CompanyMandates = tempstring + " " + cdoc.ienprojectdescription(0) + " " + cdoc.ienprojectnumber(0)

			Call doc.Save(False,False)

			Set cdoc = pickcollection3.GetnextDocument(cdoc)

		Loop

		

		Set Bdoc = pickcollection2.GetNextDocument(bdoc)

		

	Loop

	Set adoc = pickcollection1.GetNextDocument(adoc)

End If

End Sub