cancel
Showing results for 
Search instead for 
Did you mean: 

UDF (Queue), help me with this error.

former_member194481
Participant
0 Kudos

Hi All,

I am trying to convert an array of values to integers an i want to add a constant value to each value in the queue .Below is my code please help me.

Input :- 10 values from the source

output : each value + some constant.

int input[] =  new int[10];

  int k=10;

  int j[]= new int[10];

  for(int i=0; i<10; i++)

  {

  input[i] = Integer.parseInt(var1[i]);

result.addValue(j[i]=input[i]+k);

result.addContextChange();

  }

Error :

Source text of object Message Mapping: MM_Test | http://cmstran.com has syntax errors:  

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Vijay,

Please make sure that the 'Execution Type' of your UDF is set to 'All Values of Queue'.

Please make sure that you didn't add any extra open/closed braces.

I executed your UDF and it is perfectly working fine.

I suggest you to change the UDF like given below so that you can improve its functionality so that it will work for any no. of values in the queue (not just 10).


int var1Length = var1.length;

int input[] =  new int[var1Length];

  int k=10;

  int j[]= new int[var1Length];

for(int i=0; i<var1Length; i++)

{

input[i] = Integer.parseInt(var1[i]);

result.addValue(j[i]=input[i]+k);

result.addContextChange();

}

Regards,

Samanth Kunapareddi

Answers (1)

Answers (1)

Harish
Active Contributor
0 Kudos

Hi Vijay,

The error missing return will appear if you udf type is value/simple udf. Please change the udf type to queue.

refer the below blog and wiki

UDF Execution Type - Context and Queue. - Process Integration - SCN Wiki

regards,

Harish

former_member194481
Participant
0 Kudos

Hi Harish,

I have selected the Queue (Advanced UDF) only but i am  not sure why this error is coming .

i have executed the same in the eclipse it works fine , then i have copied the same and changed according to PI.even then it is failing .

please help me on this.

Thanks,

Vijay