2 arrays into one

Ace Master

Well-known member
Joined
Aug 28, 2003
Messages
140
I have 2 arrays with data like this

ex:

first:

ID,NAME
1,ACE
2,BLA
3,ACE2
....
15,BLA3

second

ID,TIME,VALUE
1,04:20,3
2,04:55,6
........
15,02:30,5

How to make this array fron those 2?

ID,NAME,TIME,VALUE
1,ACE,04:20,3
.....
15

And another important isue :

the first array is allways with all 15 values, but maybe the second one (dinamicaly generated) have some missing ids like this:

ID,TIME,VALUE
1,04:20,3
3,04:55,6
........
15,02:30,5


and in this case I want this array as result:

ID,NAME,TIME,VALUE
1,ACE,04:20,3
2,0,0
.....
15

any help will be appreciated.

thanks
 
i don think you can join them as such.
i would just create a type and a new array based on that type.

then just loop through and populate the new array.

dan
 
hi Dan.

I dont now how to populate the array.

Actualy I want at least this:

I have this array :

ID VALUE
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0


AND THIS


ID VALUE
5 2
6 3
15 4



How to make this array from those 2 ?

ID VALUE
1 0
2 0
3 0
4 0
5 2
6 3
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 4


I realy apreciate if someone knows how to make this.

thanks
 
Private myType
ID as long
Value as long
end type

dim array1 as myType
dim array2 as myType
dim count1 as integer
dim count2 as integer

i am going to leave out the population of the arrays with thier original values coz u should have that already.

for count1 = 0 to ubound(array1)

Does value exists in array2
for count2 = 0 to ubound(array2)
if array1(count1).id = array2(count2).id then
array1(count1).value = array2(count2).value
endi
next count2
next count1

dan
 
Cant make it working.

this is my code for loading those files to array info() and info1()

Code:
        load file with some empty id and values
        Dim chestie As String = cale_finala
        Dim my As New System.IO.StreamReader(chestie)
        Dim Line As Object
        Dim space As Object = "	"
        Dim enter As Object

        Line = my.ReadToEnd
        my.Close()
        info = Line.split(space)
        ________________________________________


        load file with 0 for all the values
        Dim my1 As New System.IO.StreamReader("../doze/test.doz")
        Dim Line1 As Object
        Dim space1 As Object = "	"
        Dim enter1 As Object

        Line1 = my1.ReadToEnd
        my1.Close()
        info1 = Line1.split(space)
        _____________________________________

maybe you can see better what I have here now...
 
I write this code which works perfectly if the second array (generated one) has only one id and value like this:

ID VALUE
6 26

Or

ID VALUE
14 0.5

Etc
 
Back
Top