Formatting the File Name in the Data Extraction Activity | Community
Skip to main content
shaunhill
Level 2
July 20, 2022
Solved

Formatting the File Name in the Data Extraction Activity

  • July 20, 2022
  • 1 reply
  • 1196 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by shaunhill

@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

1 reply

Amine_Abedour
Community Advisor
Community Advisor
July 20, 2022

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 

result: 

 

 

Br,

 

Amine

 

Amine ABEDOUR
shaunhill
shaunhillAuthorAccepted solution
Level 2
July 20, 2022

@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