HI,
the issue is the how to convert Textstreamio container data into system.bytes[] to pass into System.IO.MemoryStream.
below is the code I am using.
I am running a service class with multi-threading batch task. In each threading, the output is a textstreamio container data.
container con = [ field1. field2, .......field10];
textstreamio taskIO = Textstreamio::constructfromwrite(65001); (65001 represents UTF-8 encoding)
taskIO.outfielddelimiter(',');
taskio.writeexp(con);
each multi-threading batch task generates around 100,000 records and is saved in a table.
BinData data = new Bindata();
container streamContainer = taskio.read();
streamContainer = binData.getData();
ttsbegin;
tempcsvfiles.BatchHeaderId = _contract.parmbatchHeaderId();
tempcsvfiles.TaskNumber = _contract.parmTaskNumber();
tempcsvfiles.IOStreamData = streamContainer;
tempcsvfiles.insert();
ttscommit;
to merge all records,
container getfromfile;
Textstreamio textstream;
// Initialize the final stream
textStream = TextStreamIo::constructForWrite(65001);
textStream.outFieldDelimiter(',');
while select IOStreamData from tempcsvfiles order by tasknumber
{
getfromfile = tempcsvfiles.IOStreamData;
//here I have to convert container into system.bytes[] to pass into System.IO.MemoryStream
??? For D365FO ver 10.0.42 How to write this piece of code ???