Reg Arrays

Hi everybody,

I got some idea on arrays in Progress, multi dimensional arrays too. It was bit easy and interesting too.
Do we have arrays that grow dynamically? What should we do for that???
If so, can anyone give me a small example regarding that???
 
Dynamic arrays are fairly easy to create using temp-tables.

Like the other thread that was just dragged to life shows...

If you need to be super dynamic at runtime you could also implement the whole thing using dynamic queries.
 
Thank u very much. Fine...
Wil do so...
Want to know onething, is there any special reason for not providing the concepts of multi-dimensional array as well as dynamically increasing the size of array in Progress???
 
There is an intermediate option. You can define the extent as undefined and dynamically set the number of extents before assigning the extent e.g. code like this works:

Code:
DEFINE VARIABLE iExtent AS INTEGER  EXTENT   NO-UNDO.
DEFINE VARIABLE iTmp AS INTEGER INIT 10    NO-UNDO.
DEFINE VARIABLE iTel AS INTEGER     NO-UNDO.
 
ASSIGN EXTENT(iExtent) = iTmp.
DO iTel = 1 TO iTmp:
    ASSIGN iExtent[iTel] = iTel.
END.

This also aplies to input parameters. You can make a procedure which can handle different extent sizes of the same variable:

Code:
DEFINE INPUT  PARAMETER ipExtent AS INTEGER EXTENT  NO-UNDO.
DEFINE VARIABLE iTel AS INTEGER     NO-UNDO.
 
DO iTel = 1 TO EXTENT(ipExtent):
    MESSAGE ipExtent[iTel]
        VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.

Casper.
 
Hi,
The following code throughs me this error, what should be done... I was xactly waiting for this, can u provide me the xact way. Please correct the following code and give me...

******************************************************
DEFINE VARIABLE iExtent AS INTEGER EXTENT NO-UNDO.
DEFINE VARIABLE iTmp AS INTEGER INIT 10 NO-UNDO.
DEFINE VARIABLE iTel AS INTEGER NO-UNDO.

ASSIGN EXTENT(iExtent) = iTmp.
DO iTel = 1 TO iTmp:
ASSIGN iExtent[iTel] = iTel.
END.
******************************************************

Error:
** Unable to understand after -- "ASSIGN EXTENT". (247)
** Could not understand line 5. (198)
 
Which verion of Progress do you use?
This functionality was introduced in 10.1B:
OpenEdge 10.1B provides you with the ability to fix the extent (number of elements) of indeterminate array variables and parameters dynamically (in addition to parameter passing).
The following ABL elements were created or modified to implement these array enhancements:
  • The new EXTENT statement lets you fix the extent of an unfixed indeterminate array variable or parameter, dynamically.
  • The following statements were updated to note the alternative approach for fixing indeterminate array variables and parameters:
    • DEFINE VARIABLE statement
    • DEFINE PARAMETER statement
    • Parameter definition syntax
  • The following statements were updated to indicate that you can display and enable fixed indeterminate array variables (respectively):
    • DISPLAY statement
    • ENABLE statement
For more information about fixing extents on indeterminate arrays and passing arrays as parameters, see extent statement and function:
http://www.psdn.com/library/servlet/KbServlet/download/1927-102-2537/dvref.pdf

or use the online help.

HTH,

Casper.
 
For most multi-dimensional arrays, temp-tables are the easiest way of handling the data, as already mentioned.

The only exception is if you need to display the array, displaying all elements of the array in a single statement.

If you want to do that, then split the logic into two parts - one to create and use a multi-dimensional array using temp-tables and another to display the information in another one-dimensional array in a pre-defined frame.

To be honest, I've never really needed to use multi-dimensional arrays as anything else than a temp-table.
 
Sure i too go with ur view. We dont have anything to do with multi dimensional array in Progress, everything can be handled by Temp table itself.

Progress is mainly used as an application development tool for dataware housing kind of projects. So there will be no need for multi dimensional arrays, but could be helpful at some point of time.

Thank u very much for sharing ur vies with me...
 
Back
Top