Export log errors (v2024)

Hi,
v2024.16

exports are not being logged due to error:

An exception occurred while executing a query: Field ‘Filename’ doesn’t have a default value

at Exportlog.php | insert($rs)

INSERT INTO exportlog (`FileId`, `DateTime`, `User`, `ExportType`, `Table`, `KeyValue`, `Request`) VALUES(?, ?, ?, ?, ?, ?, ?)

params:


$rsnew @ function WriteExportLog($fileId, $dt, $usr, $exportType, $table, $keyValue, $fileName, $req)

appears the fieldname variable is missing in the insert statement, looks like this is missing:

    "EXPORT_LOG_FIELD_NAME_FILENAME_ALIAS" => "filename", // File name field name Alias

WriteExportLog() $rsnew should be:

    $rsnew = [
        Config("EXPORT_LOG_FIELD_NAME_FILE_ID") => $fileId,
        Config("EXPORT_LOG_FIELD_NAME_DATETIME") => $dt,
        Config("EXPORT_LOG_FIELD_NAME_USER") => $usr,
        Config("EXPORT_LOG_FIELD_NAME_EXPORT_TYPE") => $exportType,
        Config("EXPORT_LOG_FIELD_NAME_TABLE") => $table,
        Config("EXPORT_LOG_FIELD_NAME_KEY_VALUE") => $keyValue,
        Config("EXPORT_LOG_FIELD_NAME_FILENAME") => $fileName,
        **Config("EXPORT_LOG_FIELD_NAME_FILENAME_ALIAS") => $fileName,**
        Config("EXPORT_LOG_FIELD_NAME_REQUEST") => $req
    ];

once added to the array, exports were being logged to the table.

From your screen cap, params 0 is “busineses.csv” which seems to be the Filename (but is used as the FileId). Did you set up the “File Id” / “File name” fields for the “Export log table” correctly?

Hi Michael,

it was auto-generated, didn’t modify it.

if you add that field as I noted, the data is correctly inserted into the table…

No, I mean you need to check the File ID / File name field settings in your project file. You can also double check “EXPORT_LOG_FIELD_NAME_FILE_ID” / “EXPORT_LOG_FIELD_NAME_FILENAME” in the generated config file (src/config.php).