Question
· Oct 25, 2021

Extracting elements larger than max system string/charachter size from JSON messages in Healthshare v2017

We receive a JSON message containing an element which is larger than the system long string size. We are using Ensemble HealthShare v2017 which prevents us from using the %GET method as it doesn’t allow us to define the output as a Stream. We are instead trying to the read the contents of the JSON message using Readline function, and store the value into an instance of the %Stream.GlobalCharachter class, and then read from the instance of that class and write the contents of that element into a HL7 Message. However, one of the problems with that is the JSON value contains the field name and we would like to only extract the field value (not including the field name) as the %EXTRACT function truncates the value based on the system character size. Is there another function we can use to “extract” the element value without it being truncated?

 

I have recently raised a question to the community recently regarding this problem but unfortunately we are not able to upgrade to the newer version of Healthshare yet, to be able to use the %GET with an output as %Stream. (https://community.intersystems.com/post/method-retreiving-embedded-pdf-f...)

Discussion (2)2
Log in or sign up to continue

The latest version of IRIS will have improved %DynamicObject (and the %DynamicArray) class objects.  They will support a method call like obj.%Get(key,,”stream”) which will return a %Stream.DynamicCharacter oref and this %Stream can contain a very large number of characters.  This can be copied into a %Stream.GlobalCharacter or a %Stream.FileCharacter if you want to save those characters in a persistent object.

This new form of %Get will also be able to include encoding/decoding using Base64 representation.  Similar extensions have been added to the %Set method.