how to add to the RecordMap Batch
Morning guys I have a SQL operation that I use to read data and results to a record map. But seems to have trouble saving the objects to a record map as I get this message
ERROR ErrException:
zInsertObject+2^%Library.RelationshipObject.1 -- logged as '-' number - @''
please help here is my code let me know if I missing anything thank you in advance
Method OnRequest(pRequest As DQToolsSet.PrimaryMessageREQ, Output pResponse As HSCIC.DBS.RequestRBAT) As %Status
{
#dim status as %Status=$$$OK
#dim resultSet as %SQL.StatementResult
set pobject=##class(%FileCharacterStream).%New()
set preq=##class(HSCIC.DBS.RequestRBAT).%New()
set status=..Adapter.ExecuteQuery(.resultSet,..GetTheSubmissionData(pRequest.pMonth, pRequest.pApp, pRequest.pRef, pRequest.pInPat))
nbsp;if ($$$ISOK(status))
{
While (resultSet.%Next(.status) && $$$ISOK(status))
{
set ppResponse=##class(HSCIC.DBS.RequestRMAP.Record).%New()
set ppResponse.RequestCode=resultSet.Get("recType")
set ppResponse.PatientID=resultSet.Get("ClientID")
set ppResponse.DOB=resultSet.Get("DOB")
set ppResponse.Property4=resultSet.Get("u1")
set ppResponse.Property5=resultSet.Get("u2")
set ppResponse.NHSNumber=resultSet.Get("NNN")
set ppResponse.Surname=resultSet.Get("Surname")
set ppResponse.AltSurname=resultSet.Get("u3")
set ppResponse.GivenName=resultSet.Get("GivenName1")
set ppResponse.AltGivenName=resultSet.Get("u4")
set ppResponse.SpineGender=resultSet.Get("Gender")
set ppResponse.Address1=resultSet.Get("a1")
set ppResponse.Address2=resultSet.Get("a2")
set ppResponse.Address3=resultSet.Get("a3")
set ppResponse.Address4=resultSet.Get("a4")
set ppResponse.Address5=resultSet.Get("a5")
set ppResponse.PostCode=resultSet.Get("Postcode")
set ppResponse.AltAddress1=resultSet.Get("p1")
set ppResponse.AltAddress2=resultSet.Get("p2")
set ppResponse.AltAddress3=resultSet.Get("p3")
set ppResponse.AltAddress4=resultSet.Get("p4")
set ppResponse.AltAddress5=resultSet.Get("p5")
set ppResponse.AltPostCode=resultSet.Get("p6")
set ppResponse.GPCode=resultSet.Get("GPCode")
set ppResponse.GPPracticeCode=resultSet.Get("PracticeCode")
set ppResponse.NewField3=resultSet.Get("u5")
set ppResponse.NewFiel23=resultSet.Get("u6")
set status=ppResponse.%Save()
set pobject=ppResponse
set pResponse=##class(HSCIC.DBS.RequestRBAT).%New()
if ($$$ISOK(status))
{
set status=pResponse.Records.InsertObject(pobject)
set status=pResponse.Records.%Save()
}
}
}
}