cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting the nodes based on the field length

0 Kudos

Hi All,

I have a requirement wherein I have to generate the target record nodes based on the number of characters on the source field.

My source structure contains one field and the length of the field is 120.Target structure contains 3 fields the length of each field is 10.the first 30 characters of the source field must generate 1 record with 10 cahracters in each of the target field.And the next 30 caharacters must generate second record on the target side containing the same 3 fields and so on..So total 4 Records containing 3 fields in each record should be generated on the target side..


        Source         ----------->        Target

Record                                Record1(30)
      Field(120)    ------------->          Field1(10)
                                                 Field2(10)
                                                 Field3(10)
                                           Record2(30) 
                        ------------->          Field1(10)
                                                 Field2(10)
                                                 Field3(10)
                                           Record3(30)
                        ------------->          Field1(10)
                                                 Field2(10)
                                                 Field3(10)
                                           Record3(30)
                        ------------->          Field1(10)
                                                 Field2(10)
                                                 Field3(10)

Can any one help me getting this

Thanks in advance,

Vikram

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I guess using the function "<b>substring</b>" in mapping can solve your problem. Just give a try lik this.

<b>For Record1</b>

Source -


> Substring (0.....10) -


> Field1

Source -


> Substring (11...20) -


> Field2

Source -


> Substring (21...30) -


> Field3

<b>Similarly for Record2, 3 & 4</b>.

Source -


> Substring (31...40) -


> Field1

*

*

*

*

and so on..

Regards,

Sarvesh

Answers (2)

Answers (2)

0 Kudos

Thanks for the reply,

But the target records Record1 to Record4 must be created based on the length of the source field length i.e, if the source field length is only 90 then only 3 records must be created.maximum length of the source field is 120.The source and the target structure are as shown


Source                                  Target

 Record                                Record(30)
      Field(120)    ------------->          Field1(10)
                                                 Field2(10)
                                                 Field3(10)

        Source         ----------->        Target
 
Record                                Record1(0 to30)
      Field(120)    ------------->          Field1(0 to 10)
                                                 Field2(10 to 20)
                                                 Field3(20 to 30)
                                           Record2(30 to 60) 
                        ------------->          Field1(30 to 40)
                                                 Field2(40 to 50)
                                                 Field3(50 to 60)
                                           Record3(60 to 90)
                        ------------->          Field1(60 to 70)
                                                 Field2(70 to 80)
                                                 Field3( 80 to 90)
                                           Record3(90 to 120)
                        ------------->          Field1(90 to 100)
                                                 Field2(100 to 110)
                                                 Field3(110 to 120)

Hope you understood my question

Thanks

GabrielSagaya
Active Contributor
0 Kudos

Hi

for this case

you have go for User defined function using Java that include substring inorder to generate dynamic recordset

0 Kudos

Can any one provide me the code for this

GabrielSagaya
Active Contributor
0 Kudos

in sender side

RecordSet Structure=Record,*

Record.fieldNames=field1

Record.fieldFixedLength=120

in Receiver side

Recordset structure=Record1,Record2,Record3,Record4

Record1.fieldnames=field1,field2,field3

Record1.fieldFixedLength=10,10,10

Record2.fieldnames=field1,field2,field3

Record2.fieldFixedLength=10,10,10

Record3.fieldnames=field1,field2,field3

Record3.fieldFixedLength=10,10,10

Record4.fieldnames=field1,field2,field3

Record4.fieldFixedLength=10,10,10