on 12-07-2014 11:52 AM
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: |
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.