Can't see error in LS:DO

Hi,

My script below only sends through the first item in each document. When I debug the script, it shows that it goes through every single one of the items, but it doesn’t record it on the external database, it only records the first item.’

I have checked the DATASOURCE Properties and all is fine. Any suggestions?

***** Script *****

Sub Initialize

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument

Dim doc As NotesDocument

Set doc = uidoc.Document



Dim seq_id As Variant

Dim reqno As Variant

Dim itemno As Variant

Dim translatedqty As Variant

Dim itemdesc As Variant



Dim con As New ODBCConnection

Dim qry As New ODBCQuery

Dim res As New ODBCResultSet

Dim retcode As Integer



retcode%=con.ConnectTo("DATASOURCE","USERNAME","PASSWORD")



If (retcode% = False) Then

	Msgbox "Could not connect to datasource:  DATASOURCE"

	Exit Sub

End If



Set qry.connection = con

qry.SQL = "SELECT REQNO, ITNBR, QTYOR, ITDSC FROM REQHDF"

Set res.Query = qry



res.execute



counter = 0	



seq_id = doc.getitemvalue("seq_id")

reqno = doc.getitemvalue("reqno")

itemno = doc.getitemvalue("itemno")

translatedqty = doc.getitemvalue("translatedqty")

itemdesc = doc.getitemvalue("itemdesc")



Forall items In seq_id

	res.addrow

	Call res.SetValue("REQNO", reqno(0))

	Call res.SetValue("ITNBR", itemno(counter))

	Call res.SetValue("QTYOR", translatedqty(counter))

	Call res.SetValue("ITDSC", itemdesc(counter))

	

	res.updaterow

	counter=counter+1

	

End Forall



res.close(DB_CLOSE)

con.disconnect

End Sub

Subject: Can’t see error in LS:DO

Could your database be set to have request number be a unique key to the table?

If so, because you store reqno(0) everytime, you could just be overwriting your record.

Subject: Can’t see error in LS:DO

Are these multivalue fields?

seq_id = doc.getitemvalue(“seq_id”)

reqno = doc.getitemvalue(“reqno”)

itemno = doc.getitemvalue(“itemno”)

translatedqty = doc.getitemvalue(“translatedqty”)

itemdesc = doc.getitemvalue(“itemdesc”)

If so, are you getting data into these variant fields from the document? Make sure it does get data.

Also make sure the data type of each column and field match in

Call res.SetValue(“REQNO”, reqno(0))

Call res.SetValue(“ITNBR”, itemno(counter))

Call res.SetValue(“QTYOR”, translatedqty(counter))

Call res.SetValue(“ITDSC”, itemdesc(counter))