How do I generate 1 same file, recorded daily for a month, using MpDataRecorder?


This is the current settings.
The code I have written is paste down below:
// Save Top Error Data into CSV file
IF DiagCpuIsARsim() OR DiagCpuIsSimulated() THEN
DataRecordFb.MpLink := ADR(TopError);
DataRecordFb.DeviceName := ADR(‘TopErrorSim’);
DataRecordFb.RecordMode := mpDATA_RECORD_MODE_TRIGGER;
DataRecordFb();
ELSE
DataRecordFb.MpLink := ADR(TopError);
DataRecordFb.DeviceName := ADR(‘AlarmSummary’);
DataRecordFb.RecordMode := mpDATA_RECORD_MODE_TRIGGER;
DataRecordFb();
END_IF

	DataLogRegPar[0].MpLink := ADR(TopError);
	DataLogRegPar[0].Description := ADR('Module');
	DataLogRegPar[0].PVName := ADR('AlarmControl:dataReg_Module');
	DataLogRegPar[0]();

	DataLogRegPar[1].MpLink := ADR(TopError);
	DataLogRegPar[1].Description := ADR('Error Code');
	DataLogRegPar[1].PVName := ADR('AlarmControl:dataReg_Code');
	DataLogRegPar[1]();

	DataLogRegPar[2].MpLink := ADR(TopError);
	DataLogRegPar[2].Description := ADR('Error Description');
	DataLogRegPar[2].PVName := ADR('AlarmControl:dataReg_Name');
	DataLogRegPar[2]();

	DataLogRegPar[3].MpLink := ADR(TopError);
	DataLogRegPar[3].Description := ADR('Frequency');
	DataLogRegPar[3].PVName := ADR('AlarmControl:dataReg_Count');
	DataLogRegPar[3]();

	// Start Recording
	IF RTCtime_struct.hour = 23 AND RTCtime_struct.minute = 55 AND EDGEPOS(RTCtime_struct.second = 55) THEN 
		FOR d := 1 TO 300 DO
			TopErrors[d].Total_Count := uint_totalCounter[d];
			IF uint_totalCounter[d] > 0 THEN
				TopErrors[d].Error_Module := str_Alarm[d].Module;
				TopErrors[d].Error_Code := d;
				TopErrors[d].Error_Name := str_Alarm[d].Error_Name;
			ELSE
				TopErrors[d].Error_Module := '';
				TopErrors[d].Error_Code := 0;
				TopErrors[d].Error_Name := '';	
				TopErrors[d].Total_Count := 0;
			END_IF
		END_FOR
						
		Record_Trigger := TRUE;
	END_IF

	// Reset Value
	IF RTCtime_struct.hour = 23 AND RTCtime_struct.minute = 59 AND EDGEPOS(RTCtime_struct.second = 55) THEN 
		FOR c:=1 TO 300 DO              
			uint_totalCounter[c] := 0;
			TopErrors[c].Error_Code := 0;
			TopErrors[c].Error_Module := '';
			TopErrors[c].Error_Name := '';
			TopErrors[c].Total_Count := 0;
		END_FOR
	END_IF

	// Pass data into DataReg
	IF Record_Trigger THEN
		IF NextLine AND TopErrors[i_].Total_Count > 0 THEN
			dataReg_Module := TopErrors[i_].Error_Module;
			dataReg_Code := TopErrors[i_].Error_Code;
			dataReg_Name := TopErrors[i_].Error_Name;
			dataReg_Count := TopErrors[i_].Total_Count;
			i_ := i_ + 1;
			NextLine := FALSE;
		ELSIF TopErrors[i_].Total_Count = 0 THEN
			Record_Trigger := FALSE;
		END_IF
	END_IF

	// byStep_Error Function start
	IF DataRecordFb.Error = TRUE THEN 
		byStep_Error := 100;
	END_IF

	CASE byStep_Error OF		
		0:
			IF (dataReg_Module <> '' AND dataReg_Code <> 0 AND dataReg_Name <> '' AND dataReg_Count <> 0) OR (NOT DataRecordFb.Record AND NOT DataRecordFb.Recording) THEN
				// Can't overwrite the file name
				// DataRecordFb.Info.CurrentFileName := 'TopError_202411.csv';
				DataRecordFb.Trigger := TRUE;
				byStep_Error := 1;
			END_IF

			IF currentDate <> gstr_Month THEN
				byStep_Error := 3;
			END_IF

		1:
			dataReg_Module := '';
			dataReg_Code := 0;
			dataReg_Name := '';
			dataReg_Count := 0;

			DataRecordFb.Trigger := FALSE;
			IF DataRecordFb.Active THEN
				DataRecordFb.Record := TRUE;
				byStep_Error := 2;
			END_IF

		2:
			IF DataRecordFb.Recording THEN
				NextLine := TRUE;
				byStep_Error := 0;
			END_IF
		
		3:
			currentDate := gstr_Month;
			DataRecordFb.Record := FALSE;
			byStep_Error := 4;

		4:
			IF NOT DataRecordFb.Recording THEN
				byStep_Error := 0;
			END_IF	

		100:(*Error Handling*)
			DataRecordFb.Record := FALSE;
			DataRecordFb.Trigger := FALSE;
			DataRecordFb.ErrorReset := TRUE;

			IF DataRecordFb.Error = FALSE THEN 
				DataRecordFb.ErrorReset := FALSE;
				byStep_Error := 0;
			END_IF

	END_CASE

Could anyone help me on this?
I just want it all to be in 1 file, and not have _1 _2


Currently the file generated looks like this

Hi Noah,

Mapp Data does two things - records data and then exports that data. The MpDataRecorder function block records data (when commanded) to an internal buffer. The data is then automatically exported when:

  • That buffer is filled (according to the settings in the Configuration file from your first screenshot), or
  • The SnapShot input to the MpDataRecorder function block is triggered

You’re seeing extra files created because it’s automatically exporting the internal buffer to a file when the buffer fills. If you want to control the export yourself, you can set “Save automatically” to FALSE in the Configuration and then trigger the SnapShot input to the MpDataRecorder function block when you want to export the data. Just keep in mind that, if an export doesn’t happen, you may lose data once the buffer fills.