CloverDX ETL process - Source filename to the output file name

Dear Support,

I need help with the below:

1. Reading a filename.

2.Data manipulation.

3. Writing the file with the source filename with timestamp.

For example, original filename “XYZ_ABC_2456.xlsx”

We read this file and use the “FileName” to extract the source name, we take only “XYZ_ABC_2456” and add “_20240514.xlsx” so the final filename will be “XYZ_ABC_2456_20240514.xlsx”, now I wanted to give the filename as the file name to the writer to produce the final file.

Is this possible? I don’t want to use the jobflow or if it can only be done by Jobflow then can this be achieved.

Kind regards,

Hello,

Certainly, achieving that is quite straightforward. Let me introduce you to the instructions:

  1. Set up the Metadata:
    Depending on your intended data usage, you can either create User Defined Metadata or Extract them. Then, open the metadata and add a new field called “fileName”. In the field properties, locate “Autofilling” and set it to “source name”.

  2. Add the time stamp:
    In this example, I will use the Map component to modify the filename. To achieve the desired filename format you mentioned, we’ll utilize the today() function to obtain the timestamp. Then, using the date2str function, we’ll extract only the date in the desired format and set the output field fileName as source fileName + “_” + the defined date. Here’s an example code:

string thisday;
function integer transform() {

**$out.**0.data = **$in.**0.data;
thisday = date2str(today(),“yyyyMMdd”);
**$out.0.fileName = getFileNameWithoutExtension($in.**0.fileName) +“_”+ thisday;

  **return** **ALL**;  

}

  1. Set the SpreadsheetDataWriter:
    Use the “#“ placeholder for the name to define the .xlsx suffix and configure properties as follows:

Now, the graph will store files named after the source file and the date on which the data processing was executed in the data-out directory.

Best regards.

Hi Tomas, thank you so much, I will try that today, many thanks, I will update you once i have managed to work out.