[Solved]Counting elements of an Empty Array in OOO Basic

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

[Solved]Counting elements of an Empty Array in OOO Basic

Post by sokolowitzky »

Hi there,
If an array has one empty element, ooobasic ignores it, if it's the second element.
This causes a problem in a few different ways.
for example when I try to calculate ubound. Lets say I have two arrays as
obj1 = array(1,)
obj2 = array(,1)
ubound(obj1) => 0
ubound(obj2) =>1

So I wonder if there could be a way to use empty elements in array without a problem as if they are like integers or strings.
Thanks in advance.
Last edited by sokolowitzky on Mon Aug 08, 2022 6:35 am, edited 1 time in total.
Win10-OpenOffice 4.1/LibreOffice 7.4
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Counting elements of an Empty Array in OOO Basic

Post by JeJe »

obj1 = array(1,)
there is no second element. Put obj1 = array(1,EMPTY) if you want an empty one.

obj2 = array(,1)
vartype of the first value is error (10)
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply