Getting Error while reading instream in navision 2013

41 Views Asked by At

i have this code inside repeat loop, for the first time it works just fine reads stream correctly and inserts it, but when it comes to it second time i get error that i cant read when the stream is over, but it is still inside while loop its not EOS (End Of Stream), if i remove TEXTENCODING::UTF8 even if i don't put it in while loop it works, but i need encoding otherwise the information inside stream is not correct, its in other unicode simbols. i tried using bigtext too but i can not use encoding on bigtext.

JobDescriptionL.CALCFIELDS("Minor Description");
        
JobDescriptionL."MinorDescription".CREATEINSTREAM(MinorDescStream,TEXTENCODING::UTF8);
  WHILE NOT MinorDescStream.EOS DO BEGIN
    CollapseParameter := 0;
    CellData := '';
    wdTable.Cell(J,2).Range.Collapse(CollapseParameter);
    MinorDescStream.READTEXT(CellData,1);
    wdTable.Cell(J, 2).Range.InsertAfter(CellData);
  END; 
1

There are 1 best solutions below

0
On

The problem was that stream was not getting disposed, i created another function and store stream in local variable and call that function in main code, this way every time stream is being disposed and it works fine.