You can translate the question and the replies:

denodo testing with nested complex structure

Hi, I am trying to test some complex structure. Suppose I have the following view: | tech_data | | -------- | | Array | and Array is: | measurements | weights | additional | | -------- | -------- | -------- | | Register | Register | Register | for each register there are some String values. Im doing this: ``` # ------------------------------ %NAME Test name # ------------------------------ %DESCRIPTION Description # ------------------------------ %EXECUTION[query] {ds:vdp} SELECT tech_data FROM view; # ------------------------------ %RESULTS[data] technical_data "[{{'4584', '4584', '1640', '1852', '1852', '2771', '1587', '1597', '1562', '1572', 'mm'}, {'2124', '2660', '451', '611', '1540', '1170', '1000', '1200', '750', '75', '75', 'kg'}, {'10200', '0603'}}]" # ------------------------------ ``` So, the first [] corresponds to the Array. The first {} corresponds to the unique row that Array has. The next {}'s are for the three Registers. This still gives me this error: ``` Error getting elements in a complex type: {{'4584', '4584', '1640', '1852', '1852', '2771', '1587', '1597', '1562', '1572', 'mm'} ``` If I remove the first {} ``` %RESULTS[data] technical_data "[{'4584', '4584', '1640', '1852', '1852', '2771', '1587', '1597', '1562', '1572', 'mm'}, {'2124', '2660', '451', '611', '1540', '1170', '1000', '1200', '750', '75', '75', 'kg'}, {'10200', '0603'}]" # ------------------------------ ``` , this tells me the following: ``` Row 1, col 1 of the obtained result contained [[{{'4584', '4584', '1640', '1852', '1852', '2771', '1587', '1597', '1562', '1572', 'mm'}, {'2124', '2660', '451', '611', '1540', '1170', '1000', '1200', '750', '75', '75', 'kg'}, {'10200', '0603'}}]], but [[{'4584', '4584', '1640', '1852', '1852', '2771', '1587', '1597', '1562', '1572', 'mm'}, {'2124', '2660', '451', '611', '1540', '1170', '1000', '1200', '750', '75', '75', 'kg'}, {'10200', '0603'}]] was expected at that position. ``` What could be the problem?
user
23-04-2021 09:53:20 -0400

1 Answer

Hi, In order to test complex structures like arrays using Denodo Testing Tool, I would first convert the array to string in the EXECUTION section and provide the data in RESULT section accordingly. For instance, I would use the following query to convert an array to a string using [array_to_string](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/appendix/syntax_of_condition_functions/type_conversion_functions#array-to-string)() and provide the same in the EXECUTION section of the test script: ``` SELECT array_to_string('-',<ARRAY_COLUMN NAME>) as <alias-name> FROM VIEW NAME ``` You can execute the same query in the Virtual DataPort Administration Tool to get a sample of how the output data would look like. Suppose if you still need help and if you are a valid support user then you can raise a support case on [Denodo Support Site](https://support.denodo.com/) so that our support team can help you. Hope this helps!
Denodo Team
27-04-2021 06:34:00 -0400
You must sign in to add an answer. If you do not have an account, you can register here