on 2007 Feb 26 7:42 AM
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
Request clarification before answering.
HI,
In Xi , we have a provision ..
create a package with class and your required methods..
compile in NWDS. create JAR and zip it.. and come back to XI import it under Imported Archieve section .. in you mapping you can have an option ..
import : package name..
in your UDF you can use it by ref the name with package name.
Points rewarded if it is usefull.
Regards
Chilla..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wee,
a simple UDF returns string......
just see your scenario.....why do you need a UDF which returns void i.e. it returns nothing.....a simple workaround for it is - create a UDF with string return type.....do all your processing in it.......use below statement to return blank string at last of your UDF:
return "";
Well if you want a UDF with void return type, then in msg mapping, when you create a UDF, choose the context option from radio button, then the function you create will have a return type of void.
Just use this UDF in your mapping and map its output to target node.
Hope this helps you.
Thanks,
Rajeev Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> 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
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..
returning a void will be like returning an empty string or null inside a UDF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ron,
>>How can I define a custom function that returns a void?
Custom functions are developed to process some input and get a cariant of the input as output. Also, there are functions whih dont need any input and returns an output.
Can you explain your requirement as to what you need to achieve and your scenario a bit here. We can help you better.
Regards,
Jai Shankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
29 | |
9 | |
9 | |
8 | |
8 | |
7 | |
6 | |
6 | |
6 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.