Skip to Content
0
Sep 24, 2008 at 09:09 AM

Problem with Variable declaration in UDF

54 Views

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