I need to make changes to OBX 5 which shows as immutable
I have tried ConstructClone, ThrowOnError, and Streams but I can't get the syntax correct
Example
OBX|1|TX|2000.02^REASON FOR REQUEST^AS4|142|REASON FOR REQUEST: Total Cost: 0.00||||||O
^^^^ remove "REASON FOR REQUEST" ^^ add cr/lf so down stream reports can be formatted more easily
I have the code done to parse out the "REASON FOR REQUEST" but I need to make the OBX 5 show the change.
Before:
OBX|1|TX|2000.02^REASON FOR REQUEST^AS4|142|REASON FOR REQUEST: Total Cost: 0.00||||||O
OBX|1|TX|2000.02^REASON FOR REQUEST^AS4|143|Special Instructions: ||||||O
OBX|2|CE|^PROVISIONAL DIAGNOSIS|1|R52^Pain, unspecified^I10|O|||||||||||test|\0x0A\0x0D\
After
OBX|1|TX|2000.02^REASON FOR REQUEST^AS4|142| Total Cost: 0.00||||||O
blank line added
OBX|1|TX|2000.02^REASON FOR REQUEST^AS4|143|Special Instructions: ||||||O
OBX|2|CE|^PROVISIONAL DIAGNOSIS|1|R52^Pain, unspecified^I10|O|||||||||||test|\0x0A\0x0D\
FYI
Set pRequest = ##class(EnsLib.HL7.Message).%OpenId(284)
Set pOutput = pRequest.%ConstructClone()
zw pOutput
pOutput=14@EnsLib.HL7.Message ; <OREF>
+----------------- general information ---------------
| oref value: 14
| class name: EnsLib.HL7.Message
| reference count: 2
+----------------- attribute values ------------------
| %ClonedId = 284
| %Concurrency = 1 <Set>
|%maps("runtimeIndex") = 149
|%maps("runtimeIndex",0) = ""
| AutoBuildMap = 0
| BuildMapStatus = ""
| CacheSegsGotten = 1
| DocType = "2.3:ORM_O01" <Set>
| DocTypeCategory = 2.3
| DocTypeName = "ORM_O01"
| Envelope = ""
| IsMutable = 1 <Set> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
I tried concantonating cr/lf.
The do statement doesn't work
If (tItemNumberCount > 1) && (tTotalCostSegment > 0) {
Set tOBXSegment = pRequest.GetSegmentAt("ORCgrp(1).OBRuniongrp.OBXgrp("_tTotalCostSegment_").OBX", .tStatus)
Set tOBXText = tOBXSegment.GetValueAt(5)_"\X0D\\X0A\" // Append escaped CR/LF representation
Do tOBXSegment.SetValueAt(tOBXText, 5) <<<<<<<<<<<<<<<<<<<<<<<<<<
}
RESOLVED
I had to change the object for the send message
ElseIf (tMessageType="ORM") {
//$$$ThrowOnError(..SendRequestAsync(..VistaTarget, pRequest, 1, "OutputCernerToVistaORM")) // can't use object, pRequest, created for the HL7 message
// 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, pOutput, created by the clone