FindString method

Hello DomDevers,

I’m trying to extract data from a field that allows for multiple values and that separates the multiple values with a comma.

I need to search each character in this field until I hit a comma and then extract out the data to the left of the comma and place it in another field, do some stuff, and then continue searching the first field for more commas and data to extract until there are no more commas.

I look at Find String method but the Domino help does not give much detail about this .

Has anyone out there done this or have ideas to share?

**** Example of desired results *****

To different forms are used in this DB.

Text Field in Form 1: RequesterID = [ 1B23Y67, C876P54X, RF45567, H2J233R, ]

Search RequesterID find first comma, extract data to the left.

1B23Y67

Place in new field = [ 1B23Y67 ]

Use this as key field to find a document in Form 2 that contains this value and set a field to “Y” on Form 2.

Repeat this process until there are no more data strings to extract in the RequesterID field.

Subject: FindString method

You are working too hard at this. Just get the item and loop through the values:

dim varItem as variant

varItem=doc.FieldName

forall n in varItem

'do your thing for that n

end forall

Subject: RE: FindString method

OK sounds goodI put this bit of code in my QuerySave and I get a "member instance REQUESTRECID does not exist? I’m doing something wrong. What is it?

*** My Code ***********

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim thisView As NotesView

Dim doc As NotesDocument

Dim workspace As New NotesUIWorkspace

Dim varItem As Variant



Set db = session.CurrentDatabase

Set uidoc = workspace.CurrentDocument



varItem=uidoc.RequestRECID



Forall n In varItem

	key =  varitem

	n = n + 1

	

	Set view = db.GetView ("vwWorkupByRECID" )

	Set doc = view.GetDocumentByKey (key )

	

	doc.Quoted= "Yes"

	

	Call doc.Save ( True, False )	

	

	Set thisView = db.GetView ("vwPWCustomer" )

	Call  thisView.Refresh



End Forall 

End Sub

Subject: RE: FindString method

Set uidoc = workspace.CurrentDocumentset doc=uidoc.document

varItem=doc.RequestRECID

Subject: RE: FindString method

can I use varItem=doc.RequestRECID if RequestRECID is a text field? I was getting a type mismatch

Subject: RE: FindString method

Post all the code please

Subject: RE: FindString method

Sorry FileSave

here it is

*** My Code ***********

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim thisView As NotesView

Dim doc As NotesDocument

Dim workspace As New NotesUIWorkspace

Dim varItem As Variant



Set db = session.CurrentDatabase

Set uidoc = workspace.CurrentDocument



Set doc=uidoc.document



varItem=doc.RequestRECID



Forall n In varItem

	key =  varitem

	n = n + 1

	

	Set view = db.GetView ("vwWorkupByRECID" )

	Set doc = view.GetDocumentByKey (key )

	

	doc.Quoted= "Yes"

	

	Call doc.Save ( True, False )	

	

	Set thisView = db.GetView ("vwPWCustomer" )

	Call  thisView.Refresh

	

	End Forall 

End Sub

Subject: RE: FindString method

Sub Postsave(Source As Notesuidocument)

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim doc As NotesDocument

Set doc=source.document

if doc.HasItem(“RequestRECID”) then

Dim view As NotesView

Set view = db.GetView (“vwWorkupByRECID” )

dim docLookup as NotesDocument

Dim varItem As Variant

varItem=doc.GetItemValue(“RequestRECID”)

Forall n In varItem

Set docLookup = view.GetDocumentByKey (n)

if not (docLookup is nothing) then

  docLookup.Quoted= "Yes"

  Call docLookup.Save ( True, False ) 

else

  Messagebox "Document for " & n & " not

    found"

end if

End Forall

end if

End Sub