Question
· Aug 8, 2019

Business Process

Hi,
I had written one .net service for excel validation , after validation the data will be inserted in DB. I am getting value from an outbound message but the values are not inserting in DB. i have two classes one is for reading the value from excel and convert that into ensemble objects, here i am getting value. Another class for inserting the values from the ensemble objects but here i given a global variable for checking . It's shows global variable does not exist. I don't why it's not entering to 2nd class. Please give me the step by step explanation

Discussion (4)0
Log in or sign up to continue

Class User.RMHealthOutcomesProd Extends EnsLib.RecordMap.RecordMap
{

XData RecordMap [ XMLNamespace = "http://www.intersystems.com/Ensemble/RecordMap" ]
{


,




































}

/// Method to retrieve a record from a stream or device. This method will be generated based on the
/// structure of the RecordMap. For testing purposes, a file name may be passed in the pStream argument.
ClassMethod GetObject(pStream As %IO.DeviceStream, Output pObject As %RegisteredObject, pTimeout As %Numeric = -1, ByRef pLookAhead As %String = "", pLabelFound As %Boolean = 0) As %Status
{
Try {
Set tStatus = $$$OK
Set pObject = $$$NULLOREF
If '$IsObject(pStream) {
Set tFilename = pStream
Set pStream = ##class(%IO.FileStream).%New()
Do pStream.Open(tFilename,,pTimeout,"UTF-8", .tStatus)
If $$$ISERR(tStatus) Quit
}
Set tObjectName = $parameter($this,"OBJECTNAME")
Set tObject = $classmethod(tObjectName,"%New")
If '$IsObject(tObject) {
Set tStatus = $$$ERROR($$$CannotCreateObject,tObjectName)
Quit
}
Set tObject.%Source = pStream.Name
Set tGetTopFields = $parameter(tObject,"INCLUDETOPFIELDS")
If pStream.AtEnd {
Set tStatus = $$$ERROR($$$EnsRecordMapErrStreamAtEnd, pStream.Name)
Quit
}
Set pStream.CharEncoding = "UTF-8"

    #; Parse incoming stream
    Set tStatus = ..GetRecord(pStream, tObject, tGetTopFields, pTimeout, .pLookAhead, pLabelFound)
    If $$$ISERR(tStatus) Quit
}
Catch ex {
    Set tStatus = ex.AsStatus()
}
If $$$ISERR(tStatus) { Set pObject = $$$NULLOREF }
Else { Set pObject = tObject }
Quit tStatus

}

/// Method to write a record to a stream or device. This method will be generated based on the
/// structure of the RecordMap. For testing purposes, a file name may be passed in the pStream argument.
ClassMethod PutObject(pStream As %IO.DeviceStream, pObject As %RegisteredObject, pFlush As %Boolean = 1, ByRef pPadArray As %String) As %Status
{
Try {
Set tStatus = $$$OK
If '$IsObject(pStream) {
Set tFilename = pStream
Set pStream = ##class(%IO.FileStream).%New()
Do pStream.Open(tFilename,"WAE",,"UTF-8", .tStatus)
If $$$ISERR(tStatus) Quit
}
Set tHasTopFields = $parameter(pObject,"INCLUDETOPFIELDS")
Set pStream.CharEncoding = "UTF-8"

    Set tStatus = ..PutRecord(pStream, pObject, tHasTopFields, .pPadArray)
    If $$$ISERR(tStatus) Quit
    If pFlush Do pStream.Flush(.tStatus)
    If $$$ISERR(tStatus) Quit
}
Catch ex {
    Set tStatus = ex.AsStatus()
}
Quit tStatus

}

Parameter OBJECTNAME = "User.RMHealthOutcomesProd.Record";

/// Internal helper method to perform parse of incoming data
ClassMethod GetRecord(pStream As %IO.DeviceStream, pObject As %RegisteredObject, pGetTopFields As %Boolean, pTimeout As %Numeric, ByRef pLookAhead As %String = "", pLabelFound As %Boolean = 0) As %Status [ Internal, Private ]
{
Set tStatus = $$$OK
If pLabelFound { Set tRecLabel = "" }
Else { Set tRecLabel = "" }
Set tStatus = ..chunkRecord(pStream, .tRecordData, .tCharCount, "", pTimeout, $char(13,10), tRecLabel, .pLookAhead, "")
If $$$ISERR(tStatus) Quit tStatus
Set tMaxLocal = $$$MaxLocalLength
Set tRecordData("charcount") = +$get(tCharCount)
Set tCurrChunk = 1
Set tTopPiece = 1
Set tCurrSep = 1
Set tStrings = 1
Set tSeps = $listbuild($char(44))
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Else {
Set tCurrString = tRecordData(tCurrChunk)
Set tCurrPiece = 1
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.GroupCohort = tCurrString
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.ChildNumber = pObject.ChildNumberDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.GroupVisitsAtten = pObject.GroupVisitsAttenDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.OtherVisitAtten = pObject.OtherVisitAttenDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.WeeksFirstVisit = pObject.WeeksFirstVisitDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.DueDate = pObject.DueDateDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.DeliveryDate = pObject.DeliveryDateDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.VaginalBirth = pObject.VaginalBirthDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.VBAC = pObject.VBACDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.Csession = pObject.CsessionDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.Pounds = pObject.PoundsDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.Weight = pObject.WeightDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.Discharge = pObject.DischargeDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.NICU = pObject.NICUDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.NICUDays = pObject.NICUDaysDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.BefDueDate = pObject.BefDueDateDisplayToLogical(tCurrString)
}
If '$data(tRecordData(tCurrChunk, "block")) {
Set tCurrString = $piece(tRecordData(tCurrChunk), $char(44), tTopPiece)
}
Do ..checkMerge(.tCurrChunk, .tRecordData, .tCurrString, $char(44), .tTopPiece)
If pGetTopFields {
Set pObject.PractiseID = tCurrString
}
Quit tStatus
}

/// Internal helper method to output object to a stream
ClassMethod PutRecord(pStream As %IO.DeviceStream, pObject As %RegisteredObject, pHasTopFields As %Boolean, ByRef pPadArray As %String) As %Status [ Internal, Private ]
{
Set tStatus = $$$OK
Do pStream.Write($select(pHasTopFields: pObject.GroupCohort,1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.ChildNumberLogicalToDisplay(pObject.ChildNumber),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.GroupVisitsAttenLogicalToDisplay(pObject.GroupVisitsAtten),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.OtherVisitAttenLogicalToDisplay(pObject.OtherVisitAtten),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.WeeksFirstVisitLogicalToDisplay(pObject.WeeksFirstVisit),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.DueDateLogicalToDisplay(pObject.DueDate),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.DeliveryDateLogicalToDisplay(pObject.DeliveryDate),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.VaginalBirthLogicalToDisplay(pObject.VaginalBirth),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.VBACLogicalToDisplay(pObject.VBAC),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.CsessionLogicalToDisplay(pObject.Csession),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.PoundsLogicalToDisplay(pObject.Pounds),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.WeightLogicalToDisplay(pObject.Weight),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.DischargeLogicalToDisplay(pObject.Discharge),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.NICULogicalToDisplay(pObject.NICU),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.NICUDaysLogicalToDisplay(pObject.NICUDays),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.BefDueDateLogicalToDisplay(pObject.BefDueDate),1: ""),0)
Do pStream.Write($char(44) _ $select(pHasTopFields: pObject.PractiseID,1: ""),0)
Do pStream.Write($char(13,10), 0, .tStatus)
If $$$ISERR(tStatus) Quit tStatus
Quit tStatus
}

ClassMethod GetGeneratedClasses(Output pClasses As %String) As %Status
{
Kill pClasses
Set pClasses("User.RMHealthOutcomesProd.Record")=""
Set pClasses($classname())=""
Quit $$$OK
}

ClassMethod getIdentifier() As %String [ CodeMode = expression ]
{
""
}

ClassMethod getType() As EnsLib.RecordMap.Model.DataType.RecordType [ CodeMode = expression ]
{
"delimited"
}

}
In this class i am getting value.

Second class:
Class Controllers.HealthOutcomesBOperationProd Extends Ens.BusinessOperation
{

Parameter INVOCATION = "Queue";

Method OnMessage(pRequest As User.RMHealthOutcomesProd.Record, Output pResponse As Ens.Response) As %Status
{

    ///
Set tGroupCohort = pRequest.GroupCohort
set tChildNumber = pRequest.ChildNumber
set tGroupVisitsAtten =pRequest.GroupVisitsAtten
set tOtherVisitAtten = pRequest.OtherVisitAtten 
set tWeeksFirstVisit = pRequest.WeeksFirstVisit
set tDueDate = pRequest.DueDate
set tDeliveryDate = pRequest.DeliveryDate
set tVaginalBirth = pRequest.VaginalBirth
set tVBAC = pRequest.VBAC
set tCsession = pRequest.Csession
set tPounds = pRequest.Pounds
set tWeight = pRequest.Weight
set tDischarge = pRequest.Discharge
set tNICU = pRequest.NICU
set tNICUDays = pRequest.NICUDays
set tBefDueDate = pRequest.BefDueDate
set tPractiseID = pRequest.PractiseID
&SQL(Insert into CHIModel.HealthOutcomesProd(GroupCohort, ChildNumber, GroupVisitsAtten, OtherVisitAtten, WeeksFirstVisit, DueDate, DeliveryDate, VaginalBirth, VBAC, Csession, Pounds, Weight, Discharge, NICU, NICUDays, BefDueDate,PractiseID) values(:tGroupCohort, :tChildNumber, :tGroupVisitsAtten, :tOtherVisitAtten, :tWeeksFirstVisit, :tDueDate, :tDeliveryDate, :tVaginalBirth, :tVBAC, :tCsession, :tPounds, :tWeight, :tDischarge, :tNICU, :tNICUDays, :tBefDueDate, :tPractiseID))
Quit $$$OK
///

}

XData MessageMap
{


OnMessage


}

}
This class for inserting the data from ensemble object but it does not enter in this class. Previously it was working.