cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to define a function that returns a void?

Former Member
0 Likes
1,381

Hi all,

How can I define a custom function that returns a void?

My understanding is simple UDF can only return a string.

Is there any way around this limitation?

Thanks.

Ron

View Entire Topic
bhavesh_kantilal
Active Contributor
0 Likes

Hi,

User Defined Function in XI always return a String.

If you requirement is that you want to perfrom some operation in an user defined function, one option is to move it to the Java Section in your mapping and do it in the intialization / clean up section.

Else, wite a UDF that will return a Blank string as the output, and map it to the root node of the target.

Regards

Bhavesh

Former Member
0 Likes

> Hi,

> User Defined Function in XI always return a String.

>

> If you requirement is that you want to perfrom some

> operation in an user defined function, one option is

> to move it to the Java Section in your mapping and do

> it in the intialization / clean up section.

>

> Else, wite a UDF that will return a Blank string as

> the output, and map it to the root node of the

> target.

>

Hi all,

Thank you all for your kind responses.

The scenario I have is I need to insert the value of a particular field into a database table. E.g. MessageId, to keep track of the messages going through XI.

Naturally, such operations return void. These operations are already encapsulated in a custom jar file.

My purpose of using a UDF is solely to invoke the operation.

But I realized I each UDF has to have a return type, and the output of this UDF must be mapped to a node in the outgoing message.

Currently, my UDF returns an empty string, by using the implementation as below, I manage to perform my desired operation without affecting the result:

MessageId -- UDF -- CONCAT -


InstitutionCD_Transformed

InstitutionCode_____

But as you can see, this is not an elegant way of doing things.

That's why I'm seeking alternative solutions for this problem.

Bhavesh, you mentioned something about doing the operation in the initialization/cleanup section.

Can you please explain more?

Thanks.

Ron

Former Member
0 Likes

HI,

i hope....

For that you would have to use JAVA mapping ..

in that you can use the code ininitializing section....for that also it will eecute one per each message..

Please see thebelow links..

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii

Regards

Chilla..