'array size' function

Appears arraysize returns a size of 1 on an empty array. Bug?

local testArray
message str(arraysize(testArray,”,"))

This is not a bug.

There have been long discussions about this in the past. Basically, Panorama treats zero length text as an array with one empty element.

The problem is that this is an ambiguous situation – is this an empty array, or an array with one empty element? There is no absolutely right answer to this question. The arraysize( function picks the latter interpretation. If you use the extract( function, it will return zero for zero length text. So pick the one that is appropriate for your application. Or instead of text arrays you can use Panorama X’s new data array feature, which does not have this ambiguity.

Understood. I can work with this. Thanks for the concise summary!!

A simple alternative to test for an empty text array which I haven’t seen discussed is


It’s probably too obvious for anyone else to have mentioned!

David Duncan

Please re-read my post from 8/15. “” might mean an array with zero elements, or it might mean a one element array with an empty element. There is no absolutely right answer.

Now I remember you making the same point (I think) during the course sessions. It seemed to me like a sort of a zen idea at the time.

Thinking about it again, I can see that there are circumstances in which you’d want to know if there were null elements in an array.

Yes, a “zen idea” is exactly right!!