cancel
Showing results for 
Search instead for 
Did you mean: 

How to search *new line* character with UDF in mapping

Former Member
0 Kudos

Hi Techies,

from source I'm getting field with description. The description contains new line characters with which I need to search.

As of now I'm not able to read new line character in my UDF.

Please help me out.

Thanks regards

Sekhar

Edited by: DAS SEKHAR on Oct 14, 2008 7:51 PM

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

ok

Former Member
0 Kudos

Hi,

you can use the below udf which finds the \n in the description and returns the index of it.


public String find_newline(String a,Container container)
{
 //write your code here
 int i = a.indexOf("\n");
String b = Integer.toString(i);
return b;
}

While testing u hv to test as said by sudhir. It's working.

In test tab when u press enter it goes to next line so enter the data in src xml by moving to source text view.

SudhirT
Active Contributor
0 Kudos

Hi Das,

Try like this with UDF

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

for(j=0;j<a squareBracket i.length();j++)

{

if (a squareBracket i.charAt(j) == '\n')

result.addValue("Hi");

}

Thanks!

Former Member
0 Kudos

Hi Sekhar

new line mostly is \n or \r\n but if it is readable in binary file then may be you have this value with escape sequence
n

Provide more info on source to solve this

Thanks

Gaurav

Former Member
0 Kudos

Thanks for your responses.

I tried with /n but it is not atall recognizing even though there is a new line.

So how this new line is encoded in XML document,

and how it will be encoded when the payload comes to mapping.

I need this detail to catch this new line string and generate a new segment from there onwards.

I'm runnuing out of time, guys please help me.

SudhirT
Active Contributor
0 Kudos

Hi Das,

If you are trying to copy the test data directly in test tab, it wont work but for your testing you can put the test data not in tabular tree view but with source text view. i.e. when entering test data for particular field tag in xml just press enter in mid between the start tag and end tag and then test it again. It will work.

Or run end to end scenario.

Thanks!

VijayKonam
Active Contributor
0 Kudos

comparing with "\n" must solve the problem.

VJ