Skip to Content

New line in target text

Hi

I have a text as sample below and needs to mapped to target. It is not coming from source. it is constant.How can I get in separate line after each terms and condtions in target

I tried with adding everthing in constant not getting expected. Theser are up to 17 nos .Can it be done with graphical mapping ?

0, some text fsfdfdsdfsfsfsfsf

1, (1) some textdfssfsdfssffssfd

2, (2) some textdsfsdffssffsdfsfdfffffffffffffff

3,  (3)some textsdfsfsdsfffffffffffffffffffffffffffffffffffffffffffffffffffff

Expected in the target format in field

some text fsfdfdsdfsfsfsfsf

(1) some textdfssfsdfssffssfd

(2) some textdsfsdffssffsdfsfdfffffffffffffff

.

.

(16) some text dfdfsfsffsfssssssssss

Thanks

Mahesh

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    May 23, 2014 at 03:41 PM

    Hi Mahesh,

    you can use the udf in message mapping to add the line feed. Add the delimeter in the input (| in below example code) and then udf will replace | with line feed.

    /**
    @param inputRes input values to be filtered
    */
    AbstractTrace trace = container.getTrace();
      trace.addDebugMessage ("Debuggggggggggggg....TTT " + inputRes[0]);
      char[] cArray = inputRes[0].toCharArray();

    inputRes[0] = "";
    for (int i=0;i<cArray.length;i++) {
          if (cArray[i] == '|'  && cArray[i+1] == '|') {
        cArray[i] = '\n';  /* replace first | with line feed */
            inputRes[0] = inputRes[0] + cArray[i];
            i = i +1;  /* remove second | */
         }
          else {
          inputRes[0] = inputRes[0] + cArray[i];
          }
      trace.addDebugMessage ("Debuggggggggggggg.... TTT " + inputRes[0]);
    }
    result.addValue(inputRes[0]);

    regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 23, 2014 at 05:37 PM

    Hello Mahesh Kumar,

    In Message Mapping write one UDF without any input parameters and add below line in your UDF. This will generate output text in multiple lines. You can't see this output in message mapping test tab but in target file it will generate in new line.

    return "some text fsfdfdsdfsfsfsfsf \n"+" (1) some textdfssfsdfssffssfd."+"\n"+"(2) some textdsfsdffssffsdfsfdfffffffffffffff.";

    Regards

    Sateesh

    Add comment
    10|10000 characters needed characters exceeded