Skip to Content
0

Reading CSV file using Message Transforom Bean

Oct 25, 2016 at 10:47 AM

178

avatar image

Hi All,

I was working on SFTP adapter which picks the CSV file that needs to convert into XML. So i am using Message Transform Bean module for conversion. PI version is 7.31 dual stack.

Below are the config done in channel.

When the channel is picked the file payload is looks like below.

The channel was reading the filed names from the CSV file. I want to ignore that and also there is "" symbol for the values that needs to be ignore. So please suggest to resolve this.

Regards,

Raju

sftp.jpg (308.4 kB)
payload.jpg (254.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Ryan Crosby Oct 25, 2016 at 01:22 PM
0

HI Raju,

Add xml.enclosureSign = " for it to remove the double quotes around each field. As far as the header stuff you are getting information from the structure based upon the key xml.processFieldNames = fromConfiguration. That is instructing the MTB to read the data from your configuration so you should not observe any case where it is reading from the file itself.

Regards,

Ryan Crosby

Show 12 Share
10 |10000 characters needed characters left characters exceeded

Hi Ryan,

Thanks for the reply. How to ignore the header line from file. Header line contains the field names.

Regards,

Raju

0

Hi Raju,

You could try xml.documentSkipFirstRows = 1 to see if it ignores the header line. If that does not work for the SimplePlain2XML then you would have to handle that in some type of mapping or request that the header line be dropped from the source.

Regards,

Ryan Crosby

0

Thanks Ryan for the response. Now the " was removed from the data. But now " was coming in the nodes.

Example: <"Form Template ID">321</"Form Template ID">

How to remove the " from the tag. Please respond asap.

0

Hi Raju,

Can you share a screenshot of your current MTB configuration?

Regards,

Ryan Crosby

0

Above is the configuration from the channel

mtb-config1.jpg (162.4 kB)
0

Hi Raju,

Change your configuration on the xml.processFieldNames from "fromFile" to "fromConfiguration" and switch xml.documentSkipFirstRows = 1. If you intend to keep the header with the "fromFile" option then you would need to remove the " characters from the header line in the file.

Regards,

Ryan Crosby

0

Hi Ryan,

I have tried as suggested by you. Now the " removed. But field names from the files is also coming in payload which should be ignored.

used xml.documentSkipFirstRows = 1.

Regards,

Raju

0
Show more comments

Could you please share any link which specifies the StructPlain2XML

0
Show more comments

Hi Raju,

Also, you can try adding xml.enclosureSignEsc = "" into your configuration but not sure if that impacts node names. That should be reflected from the value in xml.fieldNames.

Regards,

Ryan Crosby

0

I have tried as suggested. But it didn't worked out.

0