cancel
Showing results for 
Search instead for 
Did you mean: 

Concat multiple values in a queue

Former Member
0 Kudos

Hello,

I have the following problem in message mapping:

I have one target element and several values of a source structure which I collect using an If / then function. Afterwards I remove all contexts.

What I want to do now is to concat the remaining values to be filled to a single target element.

For example there are three values left in the queue (without a context change in between) and I would like to have all of them in a single field (separated by a blank).

Using the concat function it does not work of course as the exact number of elements is determined during runtime.

Is it possible to do this with standard functions or do I need to apply an advanced UDF?

Thanks for your advice.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Here is the UDF code for the same..

While creating Advance UDF you have to select Cache as Context.

String output = "" ;

 for( int i = 0; i< a.length; i++ )
{

output =  output + a<i>;

if ( i != a.length - 1 )
{       
  output  = output + " " ;
}
}
result.addValue(output);

Regards,

Sarvesh

Former Member
0 Kudos

Perfect! Just wanted to start creating the UDF and now it is already posted Thank you very much.

Answers (2)

Answers (2)

former_member192295
Active Contributor
0 Kudos

Hi,

According to your requirement source side number of values is not static, it will change in runtime. So better to go with UDF.

Former Member
0 Kudos

I think need to apply an UDF

Rajesh

Former Member
0 Kudos

I think so too. But it should not be so difficult. I will use an advanced UDF having all queue values as input and then just looping over them and concatenate the values after each iteration.