cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Splitting a Comment

Former Member
0 Kudos

Hi all,

I have a text message in Source which i need to split into multiple values with length 1000 chars.

Source :

Comments (0..1)

Target:

Node

|-- Item1

|--TEXTNAME PO_HEADER_TEXT

|--ITEMREF

|--SEQUENCE 1

|--TEXTSTRING Text string (max length 1000 chars)

I need to increment sequence by one each time. Can any body please suggest how to do this?

Kind regards,

Kulwant

Accepted Solutions (0)

Answers (1)

Answers (1)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

hi, use the standar function copyValue.

<sourceField>-copyValue-<targetField>

by this way you will use the <sourceField> with occurrence 0...1 many times you need

Thanks

Rodrigo

Former Member
0 Kudos

Hi Rodrigo,

I need to split the comment at each 1000 chars. It can have more than 1000 chars.

Can you please reply.

Kulwant

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

create a UDF where send a parameter with the lenght of the field, the field and the max length and character

the UDF should return the field with a length = Max lenght with character.

E.X

param1: hello

lenght: 5

Max Lenght: 10

Character: -

return of UDF = hello-----

does it what you need??

Thnaks!

Former Member
0 Kudos

Hi Rodrigo,

This doesn't resolves my problem. it will return only the first 1000 chars but if there are more, how will i get that as i need to map them to the next item value.

Thanks,

Kulwant

Former Member
0 Kudos

Hi,

Can any body please reply to this.

Any help will be really appriciated.

Regards,

Kulwant

Former Member
0 Kudos

Do you need multiple item nodes for each 1000 chars and increment the sequence by 1?

You can split the string in user defined function

int j = 0;

while(j < s.length())

{

if(s.length() > (j+1000))

{

result.addvalue(s.substring(j,j + 1000));

j = j+1000;

}

else

{result.addvalue(s.substring(j)); j = j+1000;}

}

Thanks,

Beena.

Former Member
0 Kudos

Thanks Beena,

I need to try this. I have one another query. I have a node called street adress with 0..n cardinality. I need to map 1 and 2 nd row of the same to diff elements. How can i do that.

Regards,

Kulwant

Former Member
0 Kudos

hi Beena,

This worked for me. But the earlier issue, regarding the comments with 1000 char, i cannot understand. You have understood my problem correctly. Can you please provide soem detailed info as i am new to this

thanks

-Kulwant

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

hi,

you define the the parameter with length of the string you need: 1000,1200,1300.

if you need to map it to the next item value just re-use the UDF in the next field map

if im wrong, please explain better your issue.

thanks

rodrigo

Former Member
0 Kudos

Item1

|--TEXTNAME PO_HEADER_TEXT

|--ITEMREF

|--SEQUENCE 1

|--TEXTSTRING Text string (max length 1000 chars)

UDF1 - code to split the string

Try this:

content - UDF1 - item1

constant --ITEMREF

constant - TEXTNAME PO_HEADER_TEXT

content - udf1 - index -- splitbyvalue --sequence

content - udf1 - splitbyvalue --Textstring

Thanks,

Beena.