Expand my Community achievements bar.

SOLVED

Formatting the File Name in the Data Extraction Activity

Avatar

Level 2

Hello,

 

I'm running into issues with the Naming Convention in the Data Extraction activity.  We host our Instance On Prem and I can get the file to extract to the appropriate folder with this JS in the "File Name" input:

<%= formatDate(getCurrentDate(), "%4Y%2M%2D_TEST") %>.csv

&

<%= formatDate(new Date(), "%4Y%2M%2D_TEST") %>.csv

 

What I'm having issues with is that I want to add a day to the file name, I've tried :<%= formatDate(getCurrentDate() +1, "%4Y%2M%2D_TEST") %>.csv, adding a JS activity before the Data Extraction to call a date variable with the "+1", and adding the date variable in the initialization script in the advanced tab of the Data Extraction activity with no luck.  I'm getting errors regarding the "+1".

 

Is this possible to name a file a future date within the Data Extraction activity?  Thanks in advance and feel free to reach out with any questions if needed.

 

Thanks,

Shaun H.

1 Accepted Solution

Avatar

Correct answer by
Level 2

@Amine_Abedour 

 

Amine,

 

Thanks, this is exactly what I was looking for.  I never thought about calling the variable directly within the file name box.  Thanks again.

 

Regards,

Shaun

View solution in original post

2 Replies

Avatar

Community Advisor

Hello @shaunhill,

 

It is possible, here is the formula :

 

<%var tomorrow = new Date(); tomorrow.setDate(tomorrow.getDate() + 1);%><%= formatDate(tomorrow, "%4Y%2M%2D_TEST") %>.csv 

Amine_Abedour_0-1658329302595.png

result: 

 

Amine_Abedour_1-1658329314270.png

 

Br,

 

Amine

 

Avatar

Correct answer by
Level 2

@Amine_Abedour 

 

Amine,

 

Thanks, this is exactly what I was looking for.  I never thought about calling the variable directly within the file name box.  Thanks again.

 

Regards,

Shaun