cancel
Showing results for 
Search instead for 
Did you mean: 

I need to contactinate 13 source fields in one target field by g mapping

Former Member
0 Kudos

Hi,

I have 13 source fields with different names, like HitoryType1 to HistoryType13 I need to map these all fields into single target field. I am currently using the in built concate function, but i am interested to use UDF. Pls help me with the UDF code for the same.

pls feel free to ask in case of any clarification before UDF code.

-SS

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

write udf like this..

String out = f1 + f2 +f3 ..... + f13;

return out;

where f1, f2, .... f13 are 13 input fields which you will pass to UDF argument.

Former Member
0 Kudos

Sarvesh,

thnx for quick reply, but in that case we need to pass all 13 fields as input parameter to the UDF ... right ?

do we have any other option available ?

waiting

-SS

Former Member
0 Kudos

Unfortunately there is no other option left. Without passing input to udf how it will know what to concatenate?

So it is upto you to decide what you prefer to use.

Shabarish_Nair
Active Contributor
0 Kudos

>

> Sarvesh,

>

> thnx for quick reply, but in that case we need to pass all 13 fields as input parameter to the UDF ... right ?

> do we have any other option available ?

>

> waiting

>

> -SS

You have two options;

1. Go for standard graphical mapping concat function (but with 13 fields this will look too much of an art once done)

2. simply go for the udf by sarvesh

note than in either case you WILL have to provide all the 13 source fields as input

Former Member
0 Kudos

hi all,

I understand that without input system can't understand the strings. but i was thinking to have a inbuilt functionality like context or array or somethign else which will take fields by reference.

Currently I am using the "Concat" function this is going to use in m nay places in different interfaces .... so i thought of making a reusable function (UDF). Thanks Sarveh, Vijay for the inputs.

thanks to all. I am looking for a more precise solution (if possible) else Sarvesh's approach is fine with me.

-SS

Former Member
0 Kudos

You can do an UDF and store it in a function library if you want to use it in several mappings. If used inside the same mapping many times, then an ordinary UDF with 13 input parameters will do the job

Answers (1)

Answers (1)

Former Member
0 Kudos

>>have 13 source fields with different names, like HitoryType1 to HistoryType13 I need to map these all fields into single target field. I am currently using the in built concate function,

What is wrong with the standard concatenate option?

>>but i am interested to use UDF

Why? And what is wrong with the code given by Sarvesh?

You just dont "like" it?

Regards

Jai