WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Arrays
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

3-Dimensional Array

Keywords: 	   3-Dimensional Array 

Question:

I'm trying to use arrays in a new project, and I'm a little confused about how they are implemented. I have three fields I'm extracting from a database. I want each to be assigned to a variable in a dimension in an array.

So I create the array using:

NumRows=10
...
RetRows=ArrDimension(NumRows, NumRows, NumRows)
Then I have a loop that extracts rows from a result set. I set up a counter that starts at 0 and I need to load a value into each array element for each lap of this loop. What's the syntax to do this? Right now I have a line that looks like this:
RetRows[counter, counter, counter]= x,y,z
But it doesn't work. I didn't see a good example of how to do this with an array with more than one dimension (found some 1D examples). I'm also going to need to retrieve this data in a similar way. Like for the sake of example, how do I refer to the second value of the second dimension of this array? How is that done? Thanks!

Answer:

You want something closer to...
NumRows=10
...
;Allocate array 10 rows, 3 items per row
RetRows=ArrDimension(NumRows, 3)


for xx=0 to 9
;compute new values of x y and z
RetRows[xx, 0]= x
RetRows[xx, 1]= y
RetRows[xx, 2]= z
next

Article ID:   W14569
Filename:   3-Dimensional Array.txt
File Created: 2001:03:05:13:02:40
Last Updated: 2001:03:05:13:02:40