Question
· Jun 26, 2019

EnsLib.DICOM.Document - GetValueAt truncating "large" files

I have a process that receives a EnsLib.DICOM.Document, and then attempts to extract a PDF from the dataset to save to a folder.

When I use the GetValueAt method to get the pdf from the document (from the EncapsulatedDocument section), the status returned is 1, but I'm only getting the first 32648 characters(?) from the PDF.

I thought it was a string max length problem, but long strings are enabled and the final PDF is tiny (94kb) so it's not hitting the long string.

Is there some form of limit to using the GetValueAt method that I'm missing?

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

After working with WRC, I now have an answer.

If the DataSet property points to the MutabaleDateSet property then GetValueAt will return a stream if more than 32k.

If (as in my situation) the DataSet property points to the FixedDateSet property then GetValueAt will return a string of 32648.

The workaround provided by WRC did the trick for me:

               Try {
                   Set setStatus = $$$OK, getStatus = $$$OK
                   If 'pInput.Modified{
                       Set setStatus = pInput.SetValueAt(pInput.GetValueAt("DataSet.DocumentTitle",,.getStatus),"DataSet.DocumentTitle")}}
                       Catch e {
                           Set setStatus = e.AsStatus()}
                   If setStatus && getStatus{
                       Set X = pInput.GetValueAt("DataSet.EncapsulatedDocument",,.tSC)}

However there was an alternative of using the CreateFromDataSetFileStream method of the class EnsLib.DICOM.Document:

set tSC = ##class(EnsLib.DICOM.Document).CreateFromDataSetFileStream(pInput.DataSet.FileStream,pInput.DataSet.TransferSyntax,.dicomDocFromStream)

If tSC Set X = dicomDocFromStream.GetValueAt("DataSet.EncapsulatedDocument",,.tSC)

In both of these options, the next step is to then check tSC to see if X is a stream or string and then work from there.