How to every time overwrite a report file

I am trying to write a single data file through Report/Device features. However, it always makes a new entry at the end of the file. How to avoid this? I would like to overwrite this file.

I tried to write data from Cicode via DDEWrite() function, but it didn't work for me. How to correctly define variables in Wordpad?

FileCopy("C:\DataSCADA\Reports\ALReportDraft.rtf", "C:\DataSCADA\Reports\Report.rtf", 0);
Exec("C:\Program Files\Windows NT\Accessories\wordpad.exe C:\DataSCADA\Reports\Report.rtf", 6);
Sleep(3);
DDEWrite("wordpad", "C:\DataSCADA\Reports\Report.rtf", "LoadArmID", AL11LoadArmID);
DDEExec("wordpad.exe", "[Close(1)]");
DDEExec("wordpad.exe", "[Quit]");

  • Add the following in the Citect INI file

    [Report]
    RtfRollOver = 0

    From the Help section below ( i believe it's actually wrong in the help below it should be NEW REPORT FILE = 0 not 1 as i had this issue many years ago)

    [Report]RtfRollOver

    Determines whether an RTF report run using the Report function will save to a new report output file or append to the existing file. If it is saved to a new file, the existing report file is renamed.

    Allowable Values:

    • 0 - (Report information is appended to the report output file)
    • 1 - (Report information is saved to a new report output file)

    Default Value: 0