Skip to Content
avatar image
Former Member

How to define a function that returns a void?

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Feb 26, 2007 at 07:48 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 26, 2007 at 07:55 AM

    returning a void will be like returning an empty string or null inside a UDF.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 26, 2007 at 08:09 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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..

  • avatar image
    Former Member
    Feb 26, 2007 at 08:41 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 26, 2007 at 08:55 AM

    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..

    Add comment
    10|10000 characters needed characters exceeded