[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
Solved

# Multidimensional Arrays

Posted on 2001-07-26
Medium Priority
190 Views
I'm a little confused by multidimensional arrays.
Bear with me I'm currently going through the process of figuring out the boundaries of notes.
(which is a painful process)... I apologise if this is confusing to read, but I am confused in writing it.  :o)

i.e. If I have an array listed as MyArray(1,1)
With entries:
MyArray(0,0) = "Fred, Manly"
MyArray(0,1) = "Fred, Man"
MyArray(1,0) = "Rita, Womanly"
MyArray(1,1) = "Rita, Woman"

I have the following questions:
Can I change an entry without needing to define both values again?  Lets say I want to change Fred to Bob, must I enter
MyArray(0,0) = "Bob, Manly"
MyArray(0,1) = "Bob, Man"
Or is there a way to change only MyArray(0)Fred to Bob without needing to re-define the other entries?

Alternatively can they be accessed individually?  Output to a field on a form displaying Doc.Output = MyArray(1,0) would give:  Rita, Womanly

Can I just access the second value?

Basically what I would like to achieve is that I could have one field representing the person i.e. Rita and another field representing the entries associated with her. i.e. Womanly  and  Woman.

Could someone please enligten my understanding (or lack thereof).

Thanks
David.
0
Question by:dc_sava
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 4

Expert Comment

ID: 6321021
Hello David,

Little remark, if you dont want to start from 0, you can add Option Base 1
If your array is MyArray(1,1) then you have a two dimensional array.
For assigning a value to each element.
You do the follow
MyArray(0,0) = 1
MyArray(1,0) = 2
MyArray(0,1) = 3
MyArray(1,1) = 4
So, you have generate a table MyArray(x,y) where x are the rows and y are the columns.
So, if you want to specify a cell, you give the row and the column.
If you say MyArray(0,1) = "Fred, Man"
Then you give the first row, second cell, two values Fred and Man
It is not so that you have set two different cells, you've only set one cell.

I hope that it's now a little bit more clear to you.

Greets,
Sloeber
0

LVL 4

Accepted Solution

sloeber earned 400 total points
ID: 6321034
example
what I've done before is this

| 0  |  1
----------------
0  | 1  |  3
----------------
1  | 2  |  4

If you want

MyArray
|  0   |  1     |   2
--------------------------------
0  | Fred | Man    |   Manly
---------------------------------
1  | Rita | Woman  |   Womanly

MyArray(0,0) = "Fred"
MyArray(1,0) = "Rita"
MyArray(0,1) = "Man"
MyArray(1,1) = "Woman"
MyArray(0,2) = "Manly"
MyArray(1,2) = "Womanly"

So if you want to access Womanly, then
doc.output = MyArray(1,2)
...................

Greets,
Sloeber

0

LVL 8

Expert Comment

ID: 6321093
Okay, here's the way you do it :
Let's say you have two people with 3 properties so you would have an array defined like this :
Dim MyArray(2,3) as String
To set the elements you would do the following :
MyArray(0,0)="Bob"
MyArray(0,1)="Manly"
MyArray(0,2)="Man"
MyArray(1,0)="Rita"
MyArray(1,1)="Womanly"
MyArray(2,1)="Woman"

Now let's say you want to change the name from Bob to Fred.
You only need to change MyArray(0,0) so the statement is
MyArray(0,0)="Fred"
Now you can put all individual values in different fields by using the correct index.

What this array does is actually create a virtual table :
(I hope this will display readable)
| 0    | 1       | 2
----------------------------
0 | Bob  | Manly   | Man
1 | Rita | Womanly | Woman

You can reference any element in the table by using the correct coordinates, so for examplke MyArray(0,1) equals "Manly" and MyArray(1,2) equals "Woman".

So in short you will want to have every seperate element in a seperate row, column in your virtual table. Then you could look upon this as the first column, being all the names, the second column the first name property and the third column the second name property.

I hope this clears up things a bit for you. If you need any further assistance clarification, just let us know.
0

LVL 24

Expert Comment

ID: 6322035
0

Author Comment

ID: 6332522
Sloeber,

Thank-you for your response. It makes thing a lot clearer.
Now I may actually be able to use them properly.

Thanks also to Jerrith your response was as equally understandable.

Cheers
David.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
###### Suggested Courses
Course of the Month13 days, 17 hours left to enroll