cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file name creation problem

former_member537867
Active Contributor
0 Kudos

Hi Friends,

I had a requirement where i had to generate file name at target side with the following format

" raw_text_yyyymmddhhmmss.txt" . This can be acheived by using "currentdate" function but there is no field at target side which holds this value, if there was a field then i would have used variable substitution method to generate the file name.Another option is Dynamic Configuration UDF already

my root node is mapped to some src field say FLD1 based on which i will be getting multiple files.

How to customise this udf to get current date as filename for multiple target files:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");

String Outputfile = conf.put(key,a);

return Outputfile;

Regards,

Vinod.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

can you map output of this UDF to any of the NODE in your target structure that has occurrence 1..1.....so that it will not be already mapped ?

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

If you want just the outputfile with the date and time stamp, You can just provide the target file name as " raw_text_.txt" and then under the parameters tab> File construction Mode> Select Add time satmp which will append the file name along with the time stamp.

Try this I dont think you require the UDF.

Regards,

Nithiyanandam

former_member537867
Active Contributor
0 Kudos

Hi Nityanand,

Your solution is right but actually problem here is recently a slight change was made for file name it should be "raw_text_yyyy-mm-dd-hh-mm-ss.txt" by using variable substitution we get file name as this format "raw_text_yyyymmddhhmmss.txt" .

@Prateek: I cant give Currentdate as direct input to udf becoz we are generating files based on a certain field from source side.We are sorting this multiple source fields and generating target files.

Any suggestions.....

Regards,

Vinod.

Former Member
0 Kudos

did u get the answer dude.....

Edited by: MANJUNATHA CHANDRASHEKARAPPA on Feb 18, 2009 9:01 AM

prateek
Active Contributor
0 Kudos

Have you tried providing the currentDate value as direct input to the DynamicConfiguration UDF?

Regards,

Prateek