cancel
Showing results for 
Search instead for 
Did you mean: 

UDF required

allamudi_loordh
Active Participant
0 Kudos

Hi,,

i am new to java coding..can you help me on this.i am sending source some xml structure to mail as attachment.so i am concatenating all these source value and sending it to cMT_INPUT..here is my source structure.

MT_INPUT 1-1

Record_rows 0-unbound

name 1

empid 1

marks 1

i need to pass this structure to udf as three arguements or shall i go for counting the root node ..like how to proceed udf requied..

i have writeen some logic like this

Public void getcontent(String name[],String empid[],String marks[],ResultList result,Container container)

{

String str="";

int i=name.length();

for (int j=0;j,len;j++)

{

str=str+name<i>;

str=str+empid<i>;

str=str+marks<i>;

}

result.addValue(str);

}

here output i am getting like rajesh,1001,90..

only one record i am getting

how to get mulitiple records...

help is needed in coding.

Thanks

Allamudi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

chk this:

input wiil be : var1, var2,var3, var4

Execution type: all values of a context.


int a= var1.length;
String concat ="";
for(int i=0;i<a;i++)
{
concat=concat + var2<i> + "," +var3<i>+","+ var4<i>+ ",";
}
//substring function is used to remove the last "," from the concatenated output
int b=concat.length();
String output = concat.substring (0,b-1);
result.addValue(output);

mapping:


Record_rows----
name--------------remove context
empid----------------remove context------------UDF-----Traget
marks------------removecontext

allamudi_loordh
Active Participant
0 Kudos

thnaks my problem got resolver with your code

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

here output i am getting like rajesh,1001,90..

only one record i am getting

how to get mulitiple records...

help is needed in coding.

By multiple records you mean after concatting the three nodes it will be a next value? If so, do it like this


Public void getcontent(String name[],String empid[],String marks[],ResultList result,Container container)
{
int i=name.length();
for (int j=0;j,len;j++){
  String str="";
  str=str+name[j]; 
  str=str+empid[j];
  str=str+marks[j];
  result.addValue(str);
 }
}

You could also do it via the standard text function concat


name -> concat -> concat -> target
empid -> /     marks -> /

Hope this helps,

Mark