Solved

Multidimensional Arrays

Posted on 2001-07-26
5
179 Views
Last Modified: 2013-12-18
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
Comment
Question by:dc_sava
5 Comments
 
LVL 4

Expert Comment

by:sloeber
Comment Utility
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

by:
sloeber earned 100 total points
Comment Utility
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

by:Jean Marie Geeraerts
Comment Utility
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

by:HemanthaKumar
Comment Utility
0
 

Author Comment

by:dc_sava
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now