// Hook: BeforeProcessing // Copy a fresh data extract from an ETL share into the report provider folder. // // Many financial reports depend on a daily extract being in place before the // workbook opens. This script pulls the extract from the ETL output share and // drops it where the report provider expects to find it. If the source is // missing, the job halts with a descriptive error. using System.IO; var sourceExport = @"\\etl-server\exports\daily_actuals.csv"; var reportProviderPath = @"C:\ReportProviders\Financial\daily_actuals.csv"; if (!File.Exists(sourceExport)) { AddError($"Daily actuals export not found at '{sourceExport}'. Check that the ETL process has run successfully."); } var destDir = Path.GetDirectoryName(reportProviderPath); if (!string.IsNullOrEmpty(destDir) && !Directory.Exists(destDir)) Directory.CreateDirectory(destDir); try { File.Copy(sourceExport, reportProviderPath, overwrite: true); Logger.LogInformation($"Copied actuals export from '{sourceExport}' to '{reportProviderPath}'."); } catch (IOException ex) { AddError($"Failed to copy '{sourceExport}' to '{reportProviderPath}': {ex.Message}. The source file may be locked by another process."); }