Skip to Content

Requirement of reading entire input text content (CSV, fixed-length) into a output field, can be achieved using ‘File Content Conversion‘ OR ‘MessageTransformBean‘ in sender channel and a UDF in message mapping.

A1.png

Message mapping to concatenate all lines into a single line.

A2.png

Create UDF with ‘Execution Type’ : ‘All Values of a Context’. If required change newline character (\r is carriage return, \n is line feed).


public void udf_Concat(String[] eachLine, ResultList outSingleLine, Container container) throws StreamTransformationException {
    String outS = "";
    for (String line : eachLine) {
        outS = outS + line + "\r\n";
    }
    outSingleLine.addValue(outS);
}





FYI.

Above solution works for XML input also. But, better option is Copy XML Subtree

Reference for this doc: Re: FCC with multiple structure

Other solutions on SCN: Read Entire Input file data as-is in Single node and pass to Output – With Java Mapping in ESR, Whole Payload to a XML field – Process Integration – SCN Wiki

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Siva H

    Hello Raghu,

     

    Very well blog…!! We have tried all the methods to achive the same including Java mapping at last we lost all the hopes then finally we find your blog and Issue resolved…… Well done and thanks a lot..Hope to see more blogs like this in future…!!

    Regards,

    Siva

    (0) 

Leave a Reply