You can translate the question and the replies:

Pass and access arrays in VDP function

Hi, i am sorry to repeat thhis question, but with a slight modification. I have wrote a custome function (VDP function through annotation methodology ) and I would like to pass an array of double values to the function. But when I import the extension to administration tool and try to use it in the query it says, The query is returning null for this vdp function. The query I used is , ``` SELECT TOTAL_COMPREHENSIVE_INCOME_YEARLY(18, 34.56, [0.0,0.1, 0.2, 0.3,0.4]) FROM table1; ``` The function sigmnature is, ``` public Double total_comprehensive_income_yearly(Integer age, Double price, Double[] val){ } ``` Now, how do I refer the double array with indexing. When I try the noral Java notation ``` return val[2] ``` this expression return null in the sql statment I used to refer the vdp function. Greatly appreciate if someone could shed light on how to pass an array to VDP custom function. Thanks, Arun
user
28-05-2018 22:57:24 -0400
code

1 Answer

Hi, The class “CustomElementsUtil” provides methods to create the array and register types. You can refer to sample custom functions available in directory <DENODO_HOME>/samples/vdp/customFunctions. For more details, you can refer to [Compound Types](https://community.denodo.com/docs/html/browse/7.0/vdp/developer/developing_extensions/developing_custom_functions/compound_types) and [Custom Function Return Type](https://community.denodo.com/docs/html/browse/7.0/vdp/developer/developing_extensions/developing_custom_functions/custom_function_return_type) of Virtual DataPort Developer Guide. Hope this helps!
Denodo Team
29-05-2018 07:56:33 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here