Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Seeking Matches in a Data Base
#8
Sorry Steve, I haven't been able to re-create the error solution by removing the underscore in the Array name. Here is the code that I have been playing with, well almost the code, the only difference is the Read Data approach as my actual code is opening a the file with the approx 4500 lines of data. 

Originally when I wrote my hallelujah comment above the first instance of dataarray() was accepted but had an out of range error on the total_lines, which I hadn't changed to "totallines" so it appeared the run was no longer erroring out on dataarray(). 

Anyway, here's the code snippet where I'm getting an Out of Range error on data_array()

Code: (Select All)
Dim Shared data_array(1 To 100, 1 To total_lines)
'Dim Shared dataarray(1 To 100, 1 To totallines)
Dim Shared Repeat(1 To 100, 1 To total_lines)
Dim Shared LinesTotal
Dim Shared Num

Do While Num <> 101
    Read Num
    numcount = numcount + 1
    If numcount = 10 Then
        LinesTotal = LinesTotal + 1
        numcount = 0
    End If
Loop
total_lines = LinesTotal

Restore

For i = 1 To total_lines
    For j = 1 To 10
        If Num(j) = 101 Then Exit For
        Read Num(j)
        data_array(Num(j), i) = _TRUE
        'dataarray(Num(j), i) = _TRUE
    Next j
Next i

Restore

For i = 1 To total_lines
    For k = 1 To 100 'to check the 100 numbers
        If dataarray(i, k) = _FALSE Then _Continue 'no need to check the next 7 values as this number doesn't exist on this line
        For j = i + 1 To i + 7 'to check the next 7 lines
            If j > total_lines Then Exit For 'you're above the data limit.  Skip checking.
            If data_array(j, k) = _TRUE Then 'it's a match, do whatever you want with this match.   The value is k, it's on both lines i and j

                Repeat(i, k) = Repeat(i, k) + 1
            End If
        Next j
    Next k
Next i



For TL = 1 To total_lines
    Print Repeat(TL, 14);
Next TL

Data 1,15,31,25,82,12,63,64,50,47
Data 66,22,18,93,84,88,98,10,6,27
Data 19,45,46,11,12,57,71,93,100,3
Data 24,33,96,56,17,5,87,4,5,99
Data 94,17,77,89,20,76,90,8,40,49
Data 6,43,53,14,11,80,92,100,9,3
Data 84,77,73,57,28,8,15,65,69,2
Data 70,29,21,100,71,36,44,16,97,69
Data 19,83,88,23,97,80,28,5,83,84
Data 100,4,39,35,86,12,13,68,64,74
Data 101
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,064 09-30-2025, 05:38 PM
Last Post: ahenry3068
  Why is 'base' treated like a reserved word in the IDE? Pete 4 808 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)