Downsizing a dynamic arra

Downsizing a dynamic arra

Post by P}l Ting » Sat, 09 Apr 1994 07:39:59

BL>    Does anyone know of a way to get PowerBuilder to reduce the
  >size of the array by 1?

There's certainly no built-in function for your problem. The only
array functions I know of are LowerBound() and UpperBound().

Certainly, your problem could be solved easily by creating a table in
the db instead, but I suppose you want quick access to your data.

The next best thing to using arrays is to create a non-visual user
object which consists of a listbox. This way, you can use all the
powerfull functions of a listbox:
.. just to mention a few.

You can then call these functions by referencing the user object and
the function:
        uo_array.lb_listbox.AddItem ( emp_name )
        emp_name = "Kurt"
        get_row = uo_array.lb_listbox.FindItem ( emp_name )
        uo_array.lb_listbox.DeleteItem ( get_row )

To reference the variables put in the listbox, use:
        my_sle.Text = uo_array.lb_listbox.Text ( get_row )
               ^^^^                       ^^^^^
             attribute                   function

Notice that the above line uses the *function* Text(), which is used to
get items from a listbox after the AddItem() or InsertItem()
functions have been used. Many people try to use the *attribute*
Text[x] to get items from a populated listbox. This won't work.

This will be a little slower than using arrays, but you won't see a big
difference. ps: don't forget to create an instance of the object
before you manipulate it, preferably in the open event of the app.

Hope it helps....

--- a *cowboy serf


1. Downsizing a dynamic array

    I have a dynamic array of strings and I'd like to remove an
element from it. It's easy enough to write a FOR loop that walks
the array finds the target string and moves every other element
down one. The problem is that this leaves me with an array of
strings with one more element than I want, and that extra element
is the empty string.

     It is worth noting that the array may increase in size at some
later time.

    I have already considered creating a new array that is one
smaller, copying over the strings of interest, then assigning it
to the original variable, but it seems like this would be very
memory inefficient since PowerBuilder almost certainly will
duplicate every string at least once, if not twice.

    Does anyone know of a way to get PowerBuilder to reduce the
size of the array by 1?


2. counting commas

3. Business Objects With SAP ARRA in Columbia,SC for 6+ Month Contract

4. root user only can login

5. structure-array-structure-array

6. squawkbox troubles

7. al440lx, problems downsizing from 30gb to 4gb drive

8. help: chinese input method11111

9. How to downsize an Excel spreadsheet?

10. Downsizing Images

11. caviar size downsized by software!

12. Who can tell me about up- and downsizing >

13. lucky downsizing