on 08-04-2009 8:24 AM
Hi @,
I have a requirement where I wanted to genereate the recevier file name as TestYYYYMMDD.txt format.
Note that in Receiver target structure date is not coming and output file also we dont require date data.
I tried to put the Date root node and date field in target structure and in Receiver FCC i have not put the Date root node name but still date data is generated in output file.
Since its a Comma separated file hence I can not use CUT option which is applicable for Fixed length file.
I used the time stamp option but it is giving HH.MM.SS details which i dont want.
Is there any other options available.
chirag
Hi,
As prateek said, use Dynamic Configuration in Mapping.
Date-UDF--testField(disable).
Map the system date in UDF. Override the File name with that date. Map the UDF output in target field, disable the field (testField) in the target message.
Regards,
Farooq
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear All,
I tried with all the options-
For example: I have only three field values in my file which are Bike Model,BikeInformation and BikeDescription.
Probem is if i use dynamic then in target structure i have to use FilenameDate field and when I will do the FCC that value will also be available in my file which I dont want.
Thnx
chirag
When doing Dynamic Config you dont need to use any of the fields from the Target....means that you dont need to put any value in the target structure from the dynamic config UDF....so you can remove any additional field that you have included in the target structure.
Your UDF output can be mapped even to the Root node of your Target structure and the UDF need not have any value in the return statement.....just return""; will do
Regards,
Abhishek.
CurrentDate ---> DateTransform ---> UDF ---> Any node on the target (even root node will do)
UDF:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
fileName = "Test"+currentDate(input to the UDF)+".txt";
conf.put(key, fileName);
return "";
Regards,
Abhishek.
Probem is if i use dynamic then in target structure i have to use FilenameDate field and when I will do the FCC that value will also be available in my file which I dont want.
Incorrect. For DynamicConfiguration, you don't have to use payload field.
Any other options
Map it to any node which has no other mapping. Only important thing is that node should be created in mapping.
Regards,
Prateek
You can add a node 'TRAIL' with 'FILENAME' sub-node; Your target format is like this:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_FILE_STRING_OUT xmlns:ns0="HTTP://WWW.XXX.COM">
<Recordset>
<Row>3</Row>
</Recordset>
<Trail>
<Filename>DFS-XXX-20090804173307</Filename>
</Trail>
</ns0:MT_FILE_STRING_OUT>
When mapping, the UDF can be:
(imports: java.text.SimpleDateFormat;)
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String ds = sdf.format(new Date(System.currentTimeMillis()));
String filename = "DFS-ADSFCL-" + ds;
return filename;
In file adapter, you can use the adapter attributes to get the file name and the conversion to cut the trail node in the file...
Done!
Hi Chirag,
If you are facing problem in renaming the filename in Mapping, then try to develop the Custom Adapter module and rename the file as per your requirement. Use Getter and Setter message property methods.
Regards,
Chandra Shekhar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As an input to your UDF you can have the standard mapping function (currentDate)...you can do transform to have the date in desired format
while building your FileName have a similar statement:
fileName = "Test"+"currentDate"+".txt";
conf.put(Key, fileName);
Regards,
Abhishek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Chirag,
You can create a udf and can put this filename to Filename and can just map it to one of the target node and tehn you can use this in your reciever comm. channel. Just do a search for udf on SDN.
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can't you set the date as filename using DynamicConfiguration and use ASMA?
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.