Ace Master Posted December 5, 2003 Posted December 5, 2003 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 id's 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 Quote
dan182 Posted December 5, 2003 Posted December 5, 2003 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 Quote
Ace Master Posted December 10, 2003 Author Posted December 10, 2003 hi Dan. I don't 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 Quote
dan182 Posted December 11, 2003 Posted December 11, 2003 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 Quote
Ace Master Posted December 11, 2003 Author Posted December 11, 2003 Can't make it working. this is my code for loading those files to array info() and info1() '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... Quote
Ace Master Posted December 13, 2003 Author Posted December 13, 2003 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� But if I have more Id�s and values is not working at all, and don�t know why. This thing is killing me, and it must be done something like yesterday This is the code I write: Dim w As Integer = 3 For i As Integer = 2 To UBound(info1) - 2 For j As Integer = 3 To UBound(info1) - 1 For k As Integer = 1 To 15 If info1(i) = k Then info(j) = info1(w) Else info(j) = 0 End If j = j + 2 Next Next Next Thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.