Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Seeking Matches in a Data Base
#1
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.

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
 
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.
Reply


Messages In This Thread
Seeking Matches in a Data Base - by Dimster - 07-03-2025, 04:00 PM
RE: Seeking Matches in a Data Base - by SMcNeill - 07-03-2025, 04:44 PM
RE: Seeking Matches in a Data Base - by Dimster - 07-03-2025, 08:08 PM
RE: Seeking Matches in a Data Base - by SMcNeill - 07-04-2025, 12:16 AM
RE: Seeking Matches in a Data Base - by Dimster - 07-04-2025, 06:24 PM
RE: Seeking Matches in a Data Base - by Dimster - 07-05-2025, 02:40 PM
RE: Seeking Matches in a Data Base - by SMcNeill - 07-05-2025, 04:33 PM
RE: Seeking Matches in a Data Base - by Dimster - 07-06-2025, 02:42 PM
RE: Seeking Matches in a Data Base - by SMcNeill - 07-06-2025, 04:23 PM
RE: Seeking Matches in a Data Base - by Dimster - 07-07-2025, 03:51 PM
RE: Seeking Matches in a Data Base - by Dimster - 07-13-2025, 12:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Must an extra value be provided on DATA statement? dakra137 11 1,063 09-30-2025, 05:38 PM
Last Post: ahenry3068
  Why is 'base' treated like a reserved word in the IDE? Pete 4 807 04-11-2025, 09:49 PM
Last Post: SMcNeill
  Change file data krovit 5 1,219 07-11-2024, 07:45 AM
Last Post: krovit
  Arrays In User Data Types Consolemu 2 881 01-18-2024, 09:49 PM
Last Post: bplus
  Write data to EXE file Steffan-68 8 2,042 05-15-2023, 06:41 PM
Last Post: Steffan-68

Forum Jump:


Users browsing this thread: 1 Guest(s)