I have two different files, fileA contains employee data (ID and townCode) while file B contains field office data (OfficeID, Town, TownCode, officeCapacity) and a town can contain more than one office. i want to distribute these employees to the offices in the town against their names evenly
What I have tried:
I read the 2 files simulteanously and created another file to hold the last office it was distributed to. My challenge is that the distribution is not even and it picks only 2 offices for the distribution
For Each line In File.ReadLines(src1)
Dim STRDATA() As String = line.Split({","c})
employeeID = STRDATA(0)
EmpTownCode = STRDATA(1)
For Each lines In File.ReadLines(src2)
Dim STRDATA2() As String = lines.Split({","c})
OfficeID = STRDATA2(0)
StrTownName = STRDATA2(1)
StrTownCode = STRDATA2(2)
OfficeCapacity = STRDATA2(3)
For Each last In File.ReadLines(src3)
lastCentre = last.Substring(0, 16)
Next
If StrRegTown = StrTownCode Then
If StrCentreRef = lastCentre.Last Then
Exit For
End If
FileOpen(intoutfilenum, outfilepath, OpenMode.Append)
WriteLine(intoutfilenum, EmployeeID, TownCode, OfficeID, OfficeCapacity)
FileClose(intoutfilenum)
FileOpen(intoutfilenum2, outfilepath2, OpenMode.Append)
WriteLine(intoutfilenum2, OfficeID)
FileClose(intoutfilenum2)
Exit For
End If