Returning Data from a %CSP.Page
Hello Community,
to return data from the OnPage() method of a %CSP.Page I used to simply write out the value of a %DynamicArray e.g. via
and
Large objects bigger than 4MB result in an exception when trying to create return values using this way. What is best practice for returning values as JSON, especially if values exceeding the capcity of the %String class are to be expected? I saw that it is possible to write data to a file with e.g.:
Am I supposed to do this and afterwards something like this to write out data MB wise (did not try yet, if this code works - it's just an idea)?
}
Is it ok do handle big data like this or is there another (better) way recommended?
Thanks for your help, regards,
Martin
%ToJSON has three ways. One of the is to output through String, as you did with Write command.
In your case you can simply use Do command instead, and it will just output to the current device directly, without collecting it to a limited variable.
Or you can do through the stream, passed as a first parameter
So, you mean replacing
write tResponse.%ToJSON()
with
do tResponse.%ToJSON()
will do the job, even for big responses? That would be great.
Thank you,
Martin
Right, it should help with big response