I would like to manage files with Data Record by FIFO

Hello everyone.

I use mpdatarecord in mappServices.
The log is saved in the PLC in CSV file format.

but, when the PLC storage space is full, no more CSV file can be saved.
so I want to delete Oldest CSV file.

I heard that Overwrite oldest file in the mpdatarecorder configuration does not work…
image

Hi Choi,

Please check the documentation of mapp Data to verify if the behaviour you are having is the expected. I add below some key parts of the documentation.

From MpDataRecorder configuration:

Overwrite oldest file: It is possible to define the maximum number of files to be created via “Maximum number of files”. When “Overwrite oldest file = TRUE”, the oldest file is overwritten as soon as the maximum number of files has been reached, etc. The recording is not stopped. Parameter “FileCount” in the info structure of MpDataRecorder is increased if a file is overwritten. If recording to MpDataRecorder is stopped (“Record = FALSE”), function “Overwrite oldest file” is also stopped. New files are created for a new recording (“Record = TRUE”). Parameter “FileCount” in the info structure of MpDataRecorder is set to 0 again. The previously created files are not counted in the new recording. New files are created until “Maximum number of files” is reached again.

From FAQ - “Overwrite oldest file = TRUE”, but the oldest files are not overwritten:

It is possible to define the maximum number of files to be created by selecting “Maximum number of files” in the MpDataRecorder configuration. If “Overwrite oldest file = TRUE”, the oldest file is overwritten as soon as the maximum number has been reached, etc. If the recording was stopped in the meantime by “Record = FALSE” on MpDataRecorder, function “Overwrite oldest file” is also stopped. New files are created for a new recording (“Record = TRUE”) until the maximum number of files has been reached again. Previously created files are not counted.

Library FileIO can be used to prevent too many files from being created at the defined storage location over time, for example. DirInfo can be used to can check how many files are in the defined storage location. If a certain number of files has been exceeded, a file can be deleted using function FileDelete. FileInfo can be used to ensure that the oldest files are deleted.

5 Likes

Thanks your answer.
I will try something with FileIO.

Thanks so much.