cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Variable declaration in UDF

former_member1275317
Participant
0 Kudos

Hi,

I have UDF to generate queue,and it was implemented by someone. Now i need to use the same UDF in new mapping for generating new queue.

Here the Problem is UDF has some varaible "m" it wasn't declared in the UDF and working fine in previous mapping.

Now i'm getting some syntax errors when i'm using the same in new mapping like variable not delcared.

Now i need to knowIs this variable was globally declared? if so how can i declare the same in my new mapping

here i'm posting the code...

public void GenerateQ(String[] tdid,String[] zi20,ResultList result,Container container){

int i = tdid.length;

int j = zi20.length;

int k = i +j;

String s;

MappingTrace mt = container.getTrace();

for (int x =0; x<j; x++)

{

if(x ==0){

m = m + 1;

s = String.valueOf(m);

result.addValue(s);

*result.addValue(s); *

}

else if ( zi20[x].equals(ResultList.CC))

{

// mt.addInfo("Inside elseif");

m = m + 1;

s = String.valueOf(m);

// mt.addInfo(s);

result.addValue(s);

}

else

{

// mt.addInfo("Inside else");

s = String.valueOf(m);

// mt.addInfo(s);

result.addValue(s);

}

}

here m is variable for counter if i declared int m=0; UDF is not working properly it shows the counter always 1

can anybody suggest on this

regards,

Sandeep

Accepted Solutions (1)

Accepted Solutions (1)

SudhirT
Active Contributor
0 Kudos

Hi,

Open message mapping editor and upper right tool tip with "Edit java section" there u cn declare the global variable. at initialization section. declare m = 0;

Thanks!

former_member1275317
Participant
0 Kudos

Thanks sudhir..

problem solved

Regards,

Sandeep

Answers (0)