cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Filename - Variable Substitution

silentbull
Participant
0 Kudos

Hello

I am currently on PO7.4 and facing an issue with variable substitution.

I am getting the filename from the payload as TEST1234.csv.

It is populating correctly using variable substitution. And in the filename of the channel i have given as %filename%.

When I add timestamp to it, it comes like this test1234.csv20160223 rather than test123420160223.csv

Is there a way to correct this?

Please note that I don't want to do this in mapping where i can strip the .csv and add it in %filename%.csv. As we are in a migration project and would want to achieve this with config only.

Regards

Sam

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member182412
Active Contributor
0 Kudos

Hi Sam,

You can check this thread

Regards,

Praveen.

silentbull
Participant
0 Kudos

Hi Praveen

It is indeed nice trick. But again , since .CSV comes as part of my payload, I am beginning to realize that it may be difficult the insert the date without mapping change.

Regards

Krish

former_member182412
Active Contributor
0 Kudos

Hi Sam,

Deploy this module and configure in your channel as per scenario 3 in the document.

Regards,

Praveen.

silentbull
Participant
0 Kudos

Hi Vikas

As i mentioned in my post, it is easy for me to just rip off the .CSV from the mapping which is easier.

Since it is migration project, I don't want to do any changes in the mapping and just trying to find a way to achieve via config.

Regards

Sam

vicky20691
Active Contributor
0 Kudos

Hi Sam,

Please write Dynamic configuration udf and it will solve your problem.

try this

String dateFileName= new SimpleDateFormat("yyyyMMdd'.csv'").format(new Date());


String fileName=var1+dateFileName;


conf.put(key,fileName);


var1 will have value coming from payload



Regards,

Vikas