Results 1 to 2 of 2

Thread: Attempting to add and populate a column with filtered data to an array

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2026
    Posts
    33

    Attempting to add and populate a column with filtered data to an array

    Hello,

    I have a csv that contains 217 rows by 26 columns.
    The csv is attached.

    In my code I am trying the add the 27th and 28th columns "aplaynext", "hplaynext" where a is for the away team and h is for the home team. The rows relate to the matches and are in date order from the start of the season to the end of the season.

    In my code I get the first team eg (row1) (Column3, ateam) and then filter for the next occurrence of that team which might be (row7) and if that next occurrence is in (column10, hteam) I get the teamname from the corresponding (column3, ateam) and put the name in (Column26, aplaynext) , or if they are in (Column3, ateam) then I get the team name from (column10, hteam) and put the name in (column27, hplaynext)
    I go through the whole CSV until all the whoplayswhonext values are populated into columns 26 and 27.

    then I am wanting to save the result to a csv called UpdatedFixture.csv

    Unfortunately, no matter what I try, I can't seem to get the filtering right, and can't get the array to save.
    I cannot figure out what I am doing wrong.

    I am looking forward to your suggestions

    Regards,
    Antony

    Code:
    Private Sub WhoPlaysWhoNext()
        ' CSV Column descriptors  (27 columns by 217 rows) comma seperated variables, all strings
        ' abehinds	    agoals	    ascore	    ateam	    ateamid	    complete	    date	        hbehinds	hgoals	    hscore	    hteam	    hteamid	    id	        is_final	is_grand_final	localtime	            round	                roundname	timestr	    tz	    unixtime	updated	                    venue	    winner	    winnerteamid	year        playnext
        ' <Integer>     <Integer>   <Integer>   <String>    <Integer>   <Integer>       5/03/2026 19:30 <Integer>   <Integer>   <Integer>   <String>   <Integer>   <Integer>   <Integer>   <Integer>       <5/03/2026  7:30:00 PM> <5/03/2026  7:30:00 PM> <String>     <String>    +11:00  <Long>      <5/03/2026  10:16:49 PM>    <String>    <String>    <Integer>       <Integer>   <String>
    
    
        Dim daysahead As Integer
        For teamname = 0 To 17
            For tvt = 1 To 217
                If GV.NextGameTeams(teamname) = GV.The_FullFixture(tvt, 3) Then
                    If tvt > 198 Then daysahead = 217 - tvt
                    For nextgame = tvt To (tvt + daysahead)
                        If GV.The_FullFixture(nextgame, 10) = GV.NextGameTeams(teamname) Then GV.The_FullFixture(tvt, 26) = GV.The_FullFixture(nextgame, 3)
                        Debug.Print(GV.The_FullFixture(nextgame, 3) & "    " & GV.The_FullFixture(nextgame, 26))
                    Next
                End If
                If GV.NextGameTeams(teamname) = GV.The_FullFixture(tvt, 10) Then
                    If tvt > 198 Then daysahead = 217 - tvt
                    For nextgame = tvt To (tvt + daysahead)
                        If GV.The_FullFixture(nextgame, 3) = GV.NextGameTeams(teamname) Then GV.The_FullFixture(tvt, 26) = GV.The_FullFixture(nextgame, 10)
                    Next
                End If
    
            Next
        Next
        Dim UpdatedFixture As String(Of String) = GV.The_FullFixture
        My.Computer.FileSystem.WriteAllText(GV.FixturePath & "UpdateFixture.csv", UpdatedFixture, True)
    End Sub
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width