Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10022

Re: Mapping query

$
0
0

Hi,

 

1. It may not be very straightforward. Do one thing, concat all the source fields with a pipe separator as shown below. Here I have done for two fields only. You have to concatenete all so that you pass the 30 fields separated with pipe separator eg:

 

M1.JPG

Field1 | Field2 | Field3 .....Field30.

 

You will pas this to the below UDF which will calculate the no. of fields stored with the pipe separator:

 

String[] res = var1[0].split("\\|");

int tem = res.length;

 

result.addValue(tem);

 

Execution Type: All values of context.

 

2. Now you have to populate as many segments of 3rd node as per the no. of count of fields stored in the variable, which you can do by the below UDF:

 

for(int a=0;a<inp1.length;a++){

 

    for(int b=0;b<inp1[0];b++){

 

        result.addValue("");

 

}

}

 

Execution TYpe: All values of context

Input: inp1 (int)

 

M3.JPG

For populating the no of fields in source, you are getting this no. immediately after the output of the first UDF as shown above. You can map that to the Value field.

You may try to replace two UDF's by a sinlge UDF..

 

PS: Since I have concateneted only two fields, you will have to concatenete all the fields together with a pipe seperator as :

 

Field1

          Concataente ( |)  -> 

Field2                                       -> Concatenete( |) ....& so on...

                                    Field3

 

 

 

 

Hope this helps..


Viewing all articles
Browse latest Browse all 10022

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>