Powerbuilder Dynamic Array Manipulation

Posted by TomatoSandwich on Stack Overflow See other posts from Stack Overflow or by TomatoSandwich
Published on 2010-03-29T05:56:03Z Indexed on 2010/03/29 6:03 UTC
Read the original article Hit count: 532

Filed under:
|
string array[]
long lBound, uBound

lBound = LowerBound(array[]) // = 1, empty array value
uBound = UpperBound(array[]) // = 0, empty array value

array[1] = 'Item 1'
array[2] = 'Item 2'
array[3] = 'Item 3'

lBound = LowerBound(array[]) // = 1
uBound = UpperBound(array[]) // = 3

array[3] = '' //removing item 3

lBound = LowerBound(array[]) // = 1, still
uBound = UpperBound(array[]) // = 3, still (but array[3] is nulled?

I think the line 'array[3]' is wrong, but I think I've read that this should remove the array cell.

What would be the right way to remove an array cell? Does it depend on object type? (String vs Number vs Object)

Or

Can one manipulate the UpperBound value to make it work?

i.e. after removing Item 3, I want the UpperBound, or arraylength, to be 2, since this is logically correct.

© Stack Overflow or respective owner

Related posts about upperbound

Related posts about powerbuilder