07-03-2025, 04:00 PM
I have a data base of integers which run between 1 and 100. These integers are organized in a Data Base of over 4500 lines with each line of data holding 10 different integers. What I have been trying to do is to load a line of data and compare that line with the following 7 lines of data to find where the integers in the primary line may match with any integer is the subsequent 7 lines. I'm struggling with code to do this, mainly with the concept or outline of a way to do this. For example, I was thinking I may have to copy the Data Base and use one data base to draw the primary line and the other data to draw 7 other lines for comparison. I would then march thru the primary data base one line at a time however the secondary data I would need to use Seek command to reposition the start of the data lines for comparison.
Another concept of doing this was to simply just use Seek command in a Do Loop to march thru the data base. Here is a rough outline of the code for this idea. Assume all variable and arrays have been properly dimensioned.
Is there another approach that I should consider? Might there be a way to match items in a data base just using Logical Operator?? I'm going to assume any matching algorythm will be time consuming so accuracy would be more important than speed.
Another concept of doing this was to simply just use Seek command in a Do Loop to march thru the data base. Here is a rough outline of the code for this idea. Assume all variable and arrays have been properly dimensioned.
Code: (Select All)
Open "DataBase" For Input As #1
Do While Not EOF(1)
For A = 1 To 10: Input #1, aDat(A): Next
DatLineCount = DatLineCount + 1
For NextDatLine = 1 To 7
Select Case NextDatLine
Case 1
For C = 1 To 10: Input #1, cDat(C): Next
For x = 1 To 10
For y = 1 To 10
If aDat(x) = cDat(y) Then MatchcDat = MatchcDat + 1
Next y, x
Exit Select
Case 2
For D = 1 To 10: Input #1, dDat(D): Next
For x = 1 To 10
For y = 1 To 10
If aDat(x) = dDat(y) Then MatchdDat = MatchdDat + 1
Next y, x
Exit Select
Case 3
For E = 1 To 10: Input #1, eDat(E): Next
For x = 1 To 10
For y = 1 To 10
If aDat(x) = eDat(y) Then MatcheDat = MatcheDat + 1
Next y, x
Exit Select
Case 4
For F = 1 To 10: Input #1, fDat(F): Next
For x = 1 To 10
For y = 1 To 10
If aDat(x) = fDat(y) Then MatchfDat = MatchfDat + 1
Next y, x
Exit Select
Case 5
For G = 1 To 10: Input #1, gDat(G): Next
For x = 1 To 10
For y = 1 To 10
If gDat(x) = gDat(y) Then MatchgDat = MatchgDat + 1
Next y, x
Exit Select
Case 6
For H = 1 To 10: Input #1, hDat(H): Next
For x = 1 To 10
For y = 1 To 10
If aDat(x) = hDat(y) Then MatchhDat = MatchhDat + 1
Next y, x
Exit Select
Case 3
For i = 1 To 10: Input #1, iDat(i): Next
For x = 1 To 10
For y = 1 To 10
If aDat(x) = iDat(y) Then MatchiDat = MatchiDat + 1
Next y, x
Exit Select
End Select
Next NextDatLine
Seek #1, DatLineCount
Loop

