Question
Tracy Truett · Dec 3, 2021

what is the max size for an encoded PDF using the GetFieldStreamRaw code

Receiving this error ERROR #5002: Cache error: <MAXSTRING>zgetAtFromArray+28^EnsLib.HL7.Segment.1

what is the max size for an encoded PDF using the GetFieldStreamRaw code

Product version: Ensemble 2018.1
0
0 204
Discussion (9)2
Log in or sign up to continue

Can you show us an example of how you're calling the method? There is no IRIS/Caché limit on the size of the stream, but it appears that some sort of string operation may be getting in the way.

This is ensemble 2018.1 

Converting ORU to MDM

<foreach property='source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp()}' key='k1' >
<if condition='source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(k1).OBX:ValueType}="ED"' >
<true>
<assign value='k1' property='target.{OBXgrp(k1).OBX:SetIDOBX}' action='set' />
<assign value='source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(k1).OBX:ValueType}' property='target.{OBXgrp(k1).OBX:ValueType}' action='set' />
<assign value='"URL"' property='target.{OBXgrp(k1).OBX:ObservationIdentifier.Identifier}' action='set' />
<assign value='"REFERENCE POINTER"' property='target.{OBXgrp(k1).OBX:ObservationIdentifier.Text}' action='set' />
<assign value='"EXTLRR"' property='target.{OBXgrp(k1).OBX:ObservationIdentifier.NameofCodingSystem}' action='set' />
<assign value='"PDF"' property='target.{OBXgrp(k1).OBX:ObservationSubID}' action='set' />
<assign value='"PDF"' property='target.{OBXgrp(k1).OBX:ObservationValue.WaveformSource}' action='set' />
<assign value='"MERGEHEMO"_source.{MSH:MessageControlID}' property='target.{OBXgrp(k1).OBX:ObservationValue.ChannelSensitivityandUnits}' action='set' />
<assign value='"PDF"' property='target.{OBXgrp(k1).OBX:ObservationValue.ChannelCalibrationParameters}' action='set' />
<assign value='source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(k1).OBX:5(1).5}' property='target.{OBXgrp(k1).OBX:ObservationValue.ChannelSamplingFrequency}' action='set' disabled='1' />
<assign value='##class(%IO.FileStream).%New()' property='tempStream' action='set' />
<assign value='tempStream.Open(,"NEWR")' property='OK' action='set' />
<assign value='source.GetFieldStreamRaw(tempStream,"PIDgrpgrp(1).ORCgrp(1).OBXgrp("_k1_").OBX:5(1).5",.tRemainder)' property='Status' action='set' />
<assign value='tempStream.CopyReplace(.tempStreamOut,,,,,,1,1,.Status,"&amp;apos;1c ", "",$C(10),"")' property='OK' action='set' />
<assign value='target.StoreFieldStreamRaw(tempStreamOut,"OBXgrp("_k1_").OBX:ObservationValue.ChannelSamplingFrequency")' property='Status' action='set' />
<assign value='source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(k1).OBX:11}' property='target.{OBXgrp(k1).OBX:ObservationResultStatus}' action='set' />
</true>
</if>
</foreach>

You appear to be attempting to set the value of a field following the location of the stream object in the segment, and you can't do that directly ... this is a limitation specifically of working with stream objects in segments. You'll need to modify the string returned from GetFieldStreamRaw() in tRemainder and supply that as the 3rd argument to the StoreFieldStreamRaw() method.

I also just noticed that you're not passing tempStream to GetFieldStreamRaw() as a reference (no preceding "."). 

We have this code working in several DTLs, just not one that converts an ORU to an MDM. It's not making any sense.

What is even more confusing is that the DTL works when testing in Studio

We are also seeing a similar issue when the PDF is over 44 mb.

<foreach property='source.{ORCgrp(1).OBRgrp(1).OBXgrp()}' key='k1' >
<if condition='source.{ORCgrp(1).OBRgrp(1).OBXgrp(k1).OBX:ValueType}="ED"' >
<true>
<assign value='"1"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:SetIDOBX}' action='set' />
<assign value='"ED"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ValueType}' action='set' />
<assign value='"7"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationIdentifier.Identifier}' action='set' />
<assign value='"URL"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationIdentifier.Text}' action='set' />
<assign value='"EXTLRR"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationIdentifier.NameofCodingSystem}' action='set' />
<assign value='"1"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationSubID}' action='set' />
<assign value='"PDF"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationValue(1).Identifier}' action='set' />
<assign value='source.{ORCgrp(1).OBRgrp(1).OBXgrp(k1).OBX:ObservationValue(1).Text}' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationValue(1).Text}' action='set' />
<assign value='"PDF"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationValue(1).NameofCodingSystem}' action='set' />
<assign value='"Base64"' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationValue(1).AlternateIdentifier}' action='set' />
<assign value='##class(%Stream.GlobalCharacter).%New()' property='tStream' action='set' />
<assign value='source.GetFieldStreamRaw(.tStream,"ORCgrp(1).OBRgrp(1).OBXgrp("_k1_").OBX:5.5",.tRemainder)' property='tSC' action='set' />
<assign value='target.StoreFieldStreamRaw(tStream,"ORCgrp(1).OBRgrp(1).OBXgrp("_1_").OBX:5.5",tRemainder)' property='tSC' action='set' />

<assign value='""' property='$P(tRemainder,"|",11)' action='set' disabled='1' />
<assign value='..replace(..ReplaceStr(target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationValue()}),"VASC^IMAGE/PDF^BASE64^","PDF^^PDF^Base64^")' property='target.{ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationValue()}' action='set' disabled='1' />
</true>
</if>
</foreach>

Did anyone come up with solution to this issue?

The issue was that I added code below the file streaming. That has to be at the very bottom or it causes issues.