Skip to Content
author's profile photo Former Member
Former Member

Create Dynamic Field


I have a requirement for File to proxy scenario.

Sample File structure -




Here fields are not fixed in the file means its not always fixed that Name will be the 1st field in the file ; it can be last one also.

Due to this I have created the Data Type in the Sender side like that -



Here, I am inserting all the field of the file in the single field Input. I am separating the fields in an UDF in the Message mapping.

Now the problem is that some other fields can appear in the file also but no of fields will always be 5. The file can be like that also




Now my question is -

Is it possible to create field in the target side dynamically means if 'Address' field comes in the field then I want to create a field in the target side with the name 'Address' .

If possible then how?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 26, 2013 at 03:26 PM

    Hi Apu,

    you can create dynamic target node in target structure, please refer the below blog for more detail

    Message Mapping : Play around with target structure



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 26, 2013 at 03:37 PM

    Hi Apu,

    You can use XSLT or Java mapping to dynamically populate a node. Blog by Sunil sounds goods using message mapping UDF.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 02, 2014 at 10:52 AM

    Hi Apu,

    you can follow this below link to achieve this by directly writing java mapping in ESR.


    you can use the blow code in the function tab of message mapping for attributes and methods.

    sample code

    public void transform(TransformationInput in, TransformationOutput out)

    throws StreamTransformationException {

    try {

    String targetxml ="";

    String line = "";

    int counter = 0;

    String[] xmltag = new String[5]; // allocate as per numbe of columns

    String[] data = new String [5];

    StringBuffer sb = new StringBuffer();

    InputStream ins = in.getInputPayload().getInputStream();

    BufferedReader br = new BufferedReader( new InputStreamReader(ins));

    sb = sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");

    sb = sb.append("<ns0:Emp xmlns:ns0=\"\">");

    while((line=br.readLine()) != null )




    xmltag = line.split(",");




    data = line.split(",");

    sb = sb.append("<Record>");

    for(int i= 0;i<data.length;i++)


    sb = sb.append("<");

    sb = sb.append(xmltag[i]);

    sb = sb.append(">");

    sb = sb.append(data[i]);

    sb = sb.append("</");

    sb = sb.append(xmltag[i]);

    sb = sb.append(">");


    sb = sb.append("</Record>");





    sb = sb.append("</ns0:Emp>");

    targetxml =sb.toString();


    } catch (Exception e) { throw new StreamTransformationException(e.getMessage()); }


    Mapping results

    you can manipulate the code as per your requirement.



    Mapping Results.jpg (123.1 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.