on 10-20-2015 5:21 PM
Hi All,
I have requirement where I need to pick .csv file and convert it as .txt file using SFTP.
The below are the validations.
1. Must be a pipe separated, .txt file
2. Must have !##! At the end of every line in .txt file.
3. Must be encoded via UTF-8 format.
4. Need to avoid the first line from CSV i.e. function owner and department.
I am attaching source .csv file and expected target .txt file.
Could you please help me on the requirement.
Hi Vishnu
You can achieve this by performing content conversion using MessageTransformBean in both sender and receiver channel. Refer to the following wiki for sample configurations.
How To...Content conversion module with J2EE JMS adapter - Process Integration - SCN Wiki
For item 3, PI by default handle content in UTF-8 format.
For item 4, you can skip the first line by filtering it out in a mapping. Refer to my answer in the following thread.
Rgds
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yeoh,
i need to use SFTP Adapter.
So can I use Message Transform Bean as Plain2XML in sender and XML2Plain as in receiver?
Must have !##! At the end of every line in .txt file.
So for above validation i need to use end separator as !##! right? or '!##!'?
in receiver .txt file i need Header name as ORG_ID|STUD_ID!##! for that what I have to do?
Hi Vishnu
Please check the wiki properly for the correct conversion type, you should use the following:-
SimplePlain2XML - sender
SimpleXML2Plain - receiver
To fulfill the end of line requirement, you need the following parameter (need extra 'nl' at the end to have the line break)
Parameter | Value |
---|---|
xml.endSeparator | !##!'nl' |
As for the header line, you can configure the following
Parameter | Header 2 |
---|---|
xml.addHeaderLine | 3 |
xml.headerLine | ORG_ID,STUD_ID |
You can refer to the following if you want to understand further
Rgds
Eng Swee
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.