Skip to Content
avatar image
Former Member

String into many segments

Hi.

I get a string in a field that I want to covert into many segments with a field containing parts of the string.

Here's an example of a string.

S1265159S1265165S32007S32009S00612

This string should create an segment for each S part

The result should be

<segment>
   <field>S1265159<field/>
<segment/>
<segment>
   <field>S1265165<field/>
<segment/>
<segment>
   <field>S32007<field/>
<segment/>
<segment>
   <field>S32009<field/>
<segment/>
<segment>
   <field>S00612<field/>
<segment/>

I've mapped the incoming field to the segment and to the field with an UDF that looks as follow.

public void StringToSnote(String[] a,ResultList result,Container container){
String[] results = a[0].split("S");
String outdata = "";
for (int i=0; i<results.length; i++) {
	if(results<i>.length()>0)
	{
		if(results<i>.length()>8)
		{
			outdata = "S"+results<i>;
			outdata = outdata.substring(0,8);
		}
		else
		{
			outdata = "S"+results<i>;
		}
		result.addValue(outdata);
		result.addValue(ResultList.CC);
	}
         }
}

It only creates the first segment.

The qeues looks ok according to me and the correct number of segments should have been created.

What have I missed?

BR

Kalle

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 22, 2010 at 07:50 AM

    you need a similar function to map it to segment also.

    segemnt queue needs as many entries as field, but no CC

    Add comment
    10|10000 characters needed characters exceeded