How to control overwriting in Text file using FILE datatype?

Aravindh_NavisionAravindh_Navision Member Posts: 258
Hi Friends,

I need a clarification in the below code. Before that I just explain what I am doing. I have 5 dataitems and those dataitems are NOT indented. I am executing the dataitem one-by-one and writing the output into text file using FILE datatype. While doing so, the previous dataitem's output is overwritten by the later one. I have written the same code in all the dataitem's OnPostDataitem trigger.

Variables:
NFILE (Datatype: File)
WriteStream (Datatype: OutStream

OnPostDataitem():
NFile.CREATE('C:\Sample.txt');
NFile.CREATEOUTSTREAM(WriteStream);
WriteStream.WRITETEXT(Text1 + Text2 + Text3+...+Text n);
WriteStream.WRITETEXT;
NFile.CLOSE;

Can anyone point out me, where am I doing wrong?

Thanks and Regards,
Aravindh R.

Answers

Sign In or Register to comment.