on 06-13-2015 6:57 PM
Hello,
I'm trying to call a user defined function already defined in the function library in a package. How to do that? When I tried I'm getting an error saying the container should be initialized, the UDF has lot of functionality already built in, can anyone advise how this could be done?
The UDF has two string inputs and a container
Thank you.
Larry.
Is the container used within the method in function library?
When the container is not used, you simply could call the method with "null" for container.
e.g. String result = new MyFunctionLib().myFunction("var1","var2", null);
Otherwise it is not possible, as you cannot create an instance for the Container interface easily.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aber,
Please use this:
@LibraryMethod(title="<UDF name>" description="<description you like>" category="UDFPool" type="ExecutionMethod.SINGLE_VALUE")
After this use this:
Public string <UDF name> (
@Argument(title="") String a,
@Argument(title="") String b,
Container container) throws StreamTransformationException{
<ur UDF code here>
}
Note that strings a and b are the two string inputs.
Regards,
Souvik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi I'm trying to call this UDF from a Java mapping and not a graphical mapping..My questions is how can I call the UDF thats existing in the function library from the JAva mapping..I have trouble in initializing the container..
Larry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had same requirment to call UDF in java mapping. I couldn't find anything on time. So I applied another graphical mapping after my java mapping (JM target structure to same structure) to fill required fields using those udf. Just an alternate solution if you couldn't find anything on this.
Refer above screen shot to import your Function library's function in your mapping.
Hi Aber,
I echo with Ambuj,
You can either import the required function library in to your required UDF or set dependency in your SWCV on the other SWCV which is having the function library.
Try this and let us know if you still have issues.
Regards
Vishnu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Can any one help, is there a way we could do this?
Larry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please go through below blog to use a UDF from function library
if everything looks good and unable to fix it, Share some screenshots on your error message and UDF
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.