greetings to all. I was trying to build a generalized function that would allow:
a) to create a new like array object of com.sun.star.beans.PropertyValue with pair name-value contained in array a
b) to receive an already existing like array of PropertyValue as input for selective editing of only some elements
the array a in the first case contained only pairs of name-value, in the second triples of name-value-index
Oddly, once created and returned, the PropertyValue array is accessible without error by the calling program
on the contrary, fail after passed the newly created array to the function to modify only one item. Message displayed is "subroutine or function
why?
Thanks in advance for any help (libreoffice: 6.2.8.2 SO:Ubuntu 16.04
sub testPropValueSet()
dim a,b,x, o , o2
a=array(array("one", 10), array("two",20), array("three",30))
o=propValueSet(a)
msgbox (o(0).name) ' HERE ACCESS CORRECT, DISPLAYED -one-, NO ERROR
b=array(array("",35,2))
o1=propValueSet(b,o)
end sub
function propValueSet(a, optional propVal) ' ex searchProperties
dim n, bNew,i,d,r
n=ubound(a)
bNew=ismissing(propVal) ' if propVal ismissing, create propVal
if bNew then
dim propVal(n) as new com.sun.star.beans.PropertyValue
end if
for r= 0 to n
if bNew then
i=r: propVal(i).name=a(i)(0) :propVal(i).value=a(r)(1)
else
i=a(r)(2): dim o as new com.sun.star.beans.PropertyValue
if a(r)(0) <> "" then
o.name=a(r)(0)
else
' HERE THE ERROR -SUB OR FUNCTION NOT DEFINED-
d=propVal(i)
o.name=d.name : o.value=a(r)(1)
end if
propVal(i)=o
end if
next r
propValueSet=propVal
end function