473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

UDT Array in an array

Greetings:

I need some guidance. I have been using UDT's and arrays to hold
information so I can easily display data and save it. I am in the
process of building a new form and ran across a problem I can't figure
out how to solve.

I have a UDT as follows:

Public Type udtBL
scac As String * 4
BL As String * 12
GrossWt As Double
GW_UOM As String * 1
PcCt As Double
PC_UOM As String * 4
po_id() As Long
po() As String * 20
Status() As String * 2
ContainerNumber() As String * 11
SealNumber() As String * 20
TypeID() As Integer
ContGW() As Double
ContGW_UOM() As String * 1
contPC() As Double
ContPC_UOM() As String * 4
ContVol() As Double
ContVol_UOM() As String * 4
End Type

In my form I do the following

Option Explicit
Dim BL() As udtBL

Private Sub Form_Load()
Redim BL(1 to 100)
'-----Then I load it using the syntax BL(i).ContainerNumber(x) =
"Container1"
End Sub
This is all fine and dandy, but in this particular form, the Container
has multiple PO numbers I want to load as well. I have no idea how to
do this.

So i have my BL(1).BL = "BL1"
my BL(1).Container(1) = "Container1"
But then Container1 has two Purchase Orders that go with it...PO1 and
PO2.

How can I store the Purchase Orders for that container?

I would think it should be BL(1).Container(1).PO(1)

Can I do this? If so, what is the syntax? Is there a better, more
efficient way to deal with this? I am very comfortable with arrays.

I would really appreciate any help.

--rowan
Jul 17 '05 #1
1 5111
Personally ... and this would necessitate a re-write of the app ... I would
group related array-type Type members into their own UDTs, and include those
in the final UDT. For example, air code based on what appears related in
your app:

Private Type POItems
po_id As Long
po As String * 20
status As String * 2
End Type

Private Type ContainerItems
Container as <whatever>
ContainerNumber As String * 11
End Type

Private Type udtBL
<your other members>
podata() as POItems
containers() as ContainerItems
End Type

.... then use appropriately ...

dim BL() as udtBL
Redim BL(1 to 100) as udtBL ... etc etc

BL(4).containers(23).ContainerNumber = "A4K118171"
BL(4).containers(23).container = "Container1"
BL(4).podata(23).po_id = 12345
BL(4).podata(23).po = "HWK 113-131"
.... etc.

This way you can increase the number of containers or POs easily with one
redim.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Rowan" <ph********@yahoo.com> wrote in message
news:4b**************************@posting.google.c om...
: Greetings:
:
: I need some guidance. I have been using UDT's and arrays to hold
: information so I can easily display data and save it. I am in the
: process of building a new form and ran across a problem I can't figure
: out how to solve.
:
: I have a UDT as follows:
:
: Public Type udtBL
: scac As String * 4
: BL As String * 12
: GrossWt As Double
: GW_UOM As String * 1
: PcCt As Double
: PC_UOM As String * 4
: po_id() As Long
: po() As String * 20
: Status() As String * 2
: ContainerNumber() As String * 11
: SealNumber() As String * 20
: TypeID() As Integer
: ContGW() As Double
: ContGW_UOM() As String * 1
: contPC() As Double
: ContPC_UOM() As String * 4
: ContVol() As Double
: ContVol_UOM() As String * 4
: End Type
:
: In my form I do the following
:
: Option Explicit
: Dim BL() As udtBL
:
: Private Sub Form_Load()
: Redim BL(1 to 100)
: '-----Then I load it using the syntax BL(i).ContainerNumber(x) =
: "Container1"
: End Sub
:
:
: This is all fine and dandy, but in this particular form, the Container
: has multiple PO numbers I want to load as well. I have no idea how to
: do this.
:
: So i have my BL(1).BL = "BL1"
: my BL(1).Container(1) = "Container1"
: But then Container1 has two Purchase Orders that go with it...PO1 and
: PO2.
:
: How can I store the Purchase Orders for that container?
:
: I would think it should be BL(1).Container(1).PO(1)
:
: Can I do this? If so, what is the syntax? Is there a better, more
: efficient way to deal with this? I am very comfortable with arrays.
:
: I would really appreciate any help.
:
: --rowan

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a...
15
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
8
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array(...
12
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
8
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
7
by: Jim Carlock | last post by:
Looking for suggestions on how to handle bad words that might get passed in through $_GET variables. My first thoughts included using str_replace() to strip out such content, but then one ends...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.