on 07-13-2011 10:44 AM
Hi ,
I want the timestamp for a file in this format DDMMYY.
Please suggest and advise
Regards
Sai
Hi SaiMadhu,
Use CurrentDate function and map that with the below UDF.
In the CurrentDate function, in properties define as ddMMyy.
public String TimeStamp(String a,Container container){
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String myFileName = "XXX" +a+ ".txt " ;
conf.put(key, myFileName);
return "";
}
Here a is the input i.e the currentdate.
XXX- if you have any specific naming fixed to the filename. specify it over there.
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use standard date function CURRENTDATE in graphical editor.
Double click on that function and select the format you want. in this case it will be ddMMyyyy.
filename-----------------------
concat-------------------UDF()---------Target root node.
Currentedate(ddMMYYYY)-------
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
conf.put(key, filename+".txt");
return "";
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please Search in sdn before postinng, this is very common requirement and answered N number of times
here is the code
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
SimpleDateFormat dateformat = new SimpleDateFormat("ddMMyyyy");
String timestamp = dateformat.format(new Date());
String newfilename=fileName+timestamp+".txt";
conf.put(key, newfilename);
return
write UDF and map this to root node select ASMA properties in receiver channel.
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.