You can translate the question and the replies:

URGENT - length of the array

Hello, I need some help for a operation. I did a "split" operation and then after that, I would like to know **the length of the array**. select len(array1), case when len(array1)=1 then field2 else case when len(array1[1].string)=8 then substr(array1[1].string from 6 fro 3) else replace(array[1].string,'.','') end end from (select (SPLIT('_',field1) as array1, field2 from my_iv); I tried with a "count (*)", but I did not want to execute a "group by" operation, so could you please help me on this one and give me the right query for this case. Thank you very much for your help. Best regards,
user
31-10-2023 06:08:49 -0400
code

1 Answer

Hi, From your question, I understand that, your requirement is to find the length of an array. In Denodo, you could use the [len()](https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/functions/text_functions/text_functions#len) function to find the length of the string. But, in order to find the length of an array, you need to use the count() function followed by the ‘[Group BY](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/queries_select_statement/group_by_clause/group_by_clause)’ Clause, to project the selected fields. So, in your scenario, the 'group by' operation should be performed to fulfill your requirement, and this should be the only possible and easy way. You could also refer to this QA - [How to get a length of the array in Denodo?](https://community.denodo.com/answers/question/details?questionId=906Du00000000IbIAI&How+to+get+a+length+of+the+array+in+Denodo%3F) which deals with a similar scenario to your question, for more details. Further, if you have a valid support access, and if you need more assistance other than the above-provided details, then you could raise a new support case where we could assist you more. Hope this helps!
Denodo Team
01-11-2023 09:04:53 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here