cancel
Showing results for 
Search instead for 
Did you mean: 

To split the source filed in to multiple nodes, if the length of the source field is greater than 20

former_member355445
Participant
0 Kudos

HI All

I have a requirement that from source we will get 1 field  if that source filed length is 50 then the target field should split in to 3 nodes (I mean in the 1st node there should be first 20 characters and second node next 20 characters and in the third node next 10 characters. and if the source field length increase then the split of the nodes also should increase like 20, 20,20 etc)


Item Name is the source Field "ITEM_NAME" has a length more than 20 , then the first 20 length should create a node "Line_B1" in that item name field will be having the first 20 characters & second node "Line _B1 to be generated and in that ltem name field will be having the next 20 characters and it should go so on by splitting the nodes till the source filed gets fulfilled.

it means  source field has a length of 10  the 1 node will be created

                source filed has a length of 50 then 3 nodes will be created

             if source filed has a length of 100 then 5 nodes will be created ...... etc.

and also another requirement  , in the target node first field " key" is the mandatory filed for that field it should take the value from the source field for first occurrence of the node and from the second occurrence on wards a constant filed "0" should be populated in the key field place.

and another requirement  is , the second filed is "line number " in that filed I need to populate the values like for first occurrence  it should be 1, and for second occurrence it should be 2, and it should go on till all nodes are created.

please help me on this...

Actually I have created for only 2nodes generation in the mapping(BY THE HELP OF SCN , by postimng) , but  I need the logic for generating the multiple nodes based on the field length of "ITEM_NAME"

Thanks lot for your Replies in Advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member355445
Participant
0 Kudos

HI All,

I have a requirement that the fist occurrence of the target filed should get the value in the source filed. and rest occurrences should get default values. the occurrences will be coming based on the Item name filed. if the item name has the length of 200 characters the it should split in to 80 each , it means 3 nodes will be created. so for the first node there should be a original value which is coming from the target , and for the second and third field it should be default value 1  .

also the number of nodes creation may vary always.

and also , this is a line item. the Item name may get repeated.

1. if the first Item Name has 300 length then it will split in to 4 nodes , in which first node of item quantity filed should have the original field mapped to source. and the rest should have the default value 1 .

2. and the second item may have less than 80 length , at that time only original lengths only to be passed.

splitting logic is already in place, but i need the mapping & UDF for sending the default values for the second occurrence onwards

Target:

source:

MENGE is to be mapped to quantity for the first node.and rest should pass default values.

Please help me in this.

Thanks,

Vinay.

former_member190293
Active Contributor
0 Kudos

Hi Vinay!

Regards, Evgeniy.

former_member355445
Participant
0 Kudos

Thanks Evgeniy ,

Thanks a lot , it worked.

thanks for your deep explanation.

Thnaks,

Vinay.

Answers (1)

Answers (1)

former_member190293
Active Contributor
0 Kudos

Hi Vinay!

1. You could use UDF which I posted in your previous thread. It has a parameter for substring length and splits input string of variuos length into substrings of diven length.

2. If you have one value in input queue for context, you can map it to target tag as: SourceField -> MapWithDefault[0] -> TargetField.

3. Use standard function Index with parameter "Reset by context change".

Regards, Evgeniy.

former_member355445
Participant
0 Kudos

okay, thanks Evgeniy. and also can you please share the UDF for the 3rd Question.

Thanks in Adavance..........

former_member190293
Active Contributor
0 Kudos

Hi Vinay!

You don't need any UDF for that. "Index" is a standard function in graphical mapping.

Regards, Evgeniy.

former_member355445
Participant
0 Kudos

HI Evgeniy,

I hope we cannot use the Index function here, because index will count the occurrences of the source element. but here we are splitting the source in to multiple nodes . so this will not hold good. please comment.

former_member355445
Participant
0 Kudos

1. and also for your UDF where should I need to pass the value 20, so that it will break in to Segments.

former_member190293
Active Contributor
0 Kudos

Hi Vinay!

Index function sets index according to input queue, not exactly the source field. Almost every function can be used anywhere in function chain between source and target field. Moreover, output of one function can be used as input for different functions further in different chains. So if you set the output of your splitting UDF as input for function Index, it will set indexes for your splitted items.

As for UDF, just double-click on it in mapping and you'll see the parameter.

Regards, Evgeniy.

former_member355445
Participant
0 Kudos

HI All,

I have a requirement that the fist occurrence of the target filed should get the value in the source filed. and rest occurrences should get default values. the occurrences will be coming based on the Item name filed. if the item name has the length of 200 characters the it should split in to 80 each , it means 3 nodes will be created. so for the first node there should be a original value which is coming from the target , and for the second and third field it should be default value 1  .

also the number of nodes creation may vary always.

and also , this is a line item. the Item name may get repeated.

1. if the first Item Name has 300 length then it will split in to 4 nodes , in which first node of item quantity filed should have the original field mapped to source. and the rest should have the default value 1 .

2. and the second item may have less than 80 length , at that time only original lengths only to be passed.

splitting logic is already in place, but i need the mapping & UDF for sending the default values for the second occurrence onwards

Target:

like above it will goes on till it satisfies the split to 80.

source will be like below:

and the quantity of the first node of split should absorb the value from the MENGE filed , and rest occurrences should get the default value of 1 .

can you please help me on this.

thanks a lot  in Advance....

former_member355445
Participant
0 Kudos

HI Evgeniy ,

Can you please give me the UDF for the scenario which I have posted recently

Waiting for your valuable  response..

Thanks,

Vinay