go to post Gary M Lusso · May 15 Resolved I was setting .tStatus as second paramter in: Set tOBXText = pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5", .tStatus), which passed a one to anything that used the value. But I don't know why it created control characters because of it
go to post Gary M Lusso · Mar 27 You won't believe the solution !! I needed to change the send instructions with the clone object, pOutput, and NOT the HL7 message object, pRequest. Example: ElseIf (tMessageType="ORM") { //$$$ThrowOnError(..SendRequestAsync(..VistaTarget, pRequest, 1, "OutputCernerToVistaORM")) // 03272025 Must make a new command that uses the clone object instead of the HL7 message object which is immutable $$$ThrowOnError(..SendRequestAsync(..VistaTarget, pOutput, 1, "OutputCernerToVistaORM")) // Must use the object for the clone This is resolved. Now, I need to add the CR/LF
go to post Gary M Lusso · Mar 27 I moved the $ConstructClone outside the loop but chnages are getting made still Is there a way to check the contents of the clone? Code: Method FromCerner(pRequest As EnsLib.HL7.Message) As %Status{ #dim tStatus As %Status = $$$OK #dim eException As %Exception.AbstractException #dim tOBXSegment As EnsLib.HL7.Segment #dim tOBXText As %String #dim tItemNumberCount As %Integer = 0 #dim tItemNumberProcessed As %Integer = 0 #dim tTotalCostSegment As %Integer = 0 #dim tOrderType As %String #dim i As %Interger = 0 #dim tOBXKey As %Integer = 0 #dim tOBXTextChanged As %String // // Set the message Set tMessageType = pRequest.GetValueAt("MSH:9.1") Try { // Message Subtype // Message Subtype Set tMessageSubType = pRequest.GetValueAt("ORCgrp(1).ORC:1") //$$$LOGINFO(tMessageSubType_"----- tMessageSubType - = NW -- ") // // Check if OBR:19 contains "Implant Usage (PSAS)" OR "Issued in Clinic (PSAS)" Set tOrderType = pRequest.GetValueAt("ORCgrp(1).OBRuniongrp.OBRunion.OBR:19(1).1") //$$$LOGINFO(tOrderType_" ---- tOrderType Ordder Type = Implant Usage (PSAS) for first interation") If ((tOrderType["Implant Usage (PSAS)") || (tOrderType["Issued in Clinic (PSAS)")) { // First loop: Count occurrences of "Item Number:" Set i = 1 Set tItemNumberCount = 0 Set pOutput = pRequest.%ConstructClone(1) // moved here because %ConstructClone() need only be done at the message object level. $$$LOGINFO(pOutput_" ---- pOutput to see if clone is created****") While (pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX")'="") { Set tOBXText = pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5", .tStatus) $$$LOGINFO(tOBXText_"**** "_i_" ---- tOBXText OBX 5 text and i value") // working // If (tOBXText [ "Item Number:") { Set tItemNumberCount = tItemNumberCount + 1 } // If (tOBXText[ "Total Cost:") { Set tTotalCostSegment = i //$$$LOGINFO(tTotalCostSegment_" ------ tTotalCostSegment check Total Cost") } Set i = i + 1 } // Second loop: Modify OBX segments if necessary Set i = 1 //Set pOutput = pRequest.%ConstructClone(1) //%ConstructClone() need only be done at the message object level. Set tItemNumberProcessed = 0 While (pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX")'="") { Set tOBXText = pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5", .tStatus) // using pOutput instead of pRequest //$$$LOGINFO(tOBXText_" ---- tOBXText get OBX 5 text") If (tOBXText [ "Item Number:") { Set tItemNumberProcessed = tItemNumberProcessed + 1 } If (tItemNumberCount > 1) && (tOBXText [ "REASON FOR REQUEST:") { set tOBXKey = i Set tOBXText=$p(tOBXText,":",2,5) /// OBX 5 text parsed to replace in OBX 5 later // Start replacement process Do pOutput.SetValueAt(tOBXText,"ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5","set") // was a typo //$$$LOGINFO(tOBXText_" ---- OBX 5 parsed to be saved in new OBX 5") Set tOBXTextChanged = pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5") // typo //$$$LOGINFO(i_" **** "_tOBXTextChanged_" --- i --- tOBXTextChanged, Is OBX 5 changed???") // OBX 5 is changed but not saved } Set i = i + 1 } } //Do pOutput.%Save() Set tSave2 = pOutput.%Save() $$$LOGINFO(tSave2_" ---- did it save") // The OBX 5 changes just aren't getting saved
go to post Gary M Lusso · Mar 26 Does the %ConstructClone()/GetSegmentAt()/SaveValeAt have to be done on every OBX segment object as it goes through the loop? When do you put a number in ConstructClone(1) ?
go to post Gary M Lusso · Mar 25 I really appreciate the help. I wish there were freelancers that I could pay to help.
go to post Gary M Lusso · Mar 25 It shows pRequest and pOutput to see what the differenece is,.I will commetn out pRequest I think I am usng pOutput from the clone? Set pOutput = pRequest.%ConstructClone(1) Set tSC=tOBXSegmentpOutput.SetValueAt(pOutput, 5) does this save the chnage? Set tSC = tOBXSegmentpOutput.SaveData()
go to post Gary M Lusso · Mar 25 The $ConstructClone works to change the OBX 5 values but how do I make the changes in the message permanent? I'm still working on the cr/lf I'm real rusty on DTL
go to post Gary M Lusso · Mar 25 Thanks. I'm rusty using DTL. I have to research that more but I agree. I have the parsing and setting the OBX 5 segment working but it isn't saving the changes to the message