Link to home
Start Free TrialLog in
Avatar of Bob Schneider
Bob SchneiderFlag for United States of America

asked on

Text to Sql Server Process Question

I have an RFID timing system that returns race finishers via a line in a text file.  Lets call that text file "raw reads".  Each participant is read at least once but usually several times due to the fact that there are several finish line mats, each with it's own reader.

I have written code to parse that data into an array (basically pulling out their best time and their bib number), shown in a list box.  At this point I send that to a sql server database that collects the other information about each participant (name, gender, age, etc).  This works fine, but...

Since I refresh this array multiple times during the race, and some races get pretty big (several thousand runners), I would like to not have to go back and get all data from the "raw reads" text file.  I would like to just pick up where I left off.  How can I do that?

Here is the code I use to get the data from the "raw reads" text file:
    k = 0
    
    If Not sRFIDFile = vbNullString Then
        frmRFID2.lstRawData.Clear
        frmRFID2.lstRawData.AddItem "NO" & vbTab & "DATA"
        
        iFileNum = FreeFile()

        Open sRFIDFile For Input As iFileNum
        sFileData = Input(LOF(iFileNum), #iFileNum)
        Close iFileNum
        
        LineArr = Split(sFileData, vbCrLf)
        sFileData = vbNullString
        
        For i = 0 To UBound(LineArr) - 1
            strFields = Split(LineArr(i), ",")

            sThisLine = LineArr(i)
            
            sThisBib = strFields(1)
            sThisChip = strFields(2)
            sThisTime = strFields(3)
                
            If Len(sThisBib) <= 4 Then
                sThisTime = Replace(sThisTime, """", "")
                sngThisTime = ConvertToSeconds(sThisTime)
                iThisBib = CInt(sThisBib)
            
                If sngThisTime > sngStartTime + sngMinTime Then
                    RawRslts(0, k) = k + 1
                    RawRslts(1, k) = sThisBib
                    RawRslts(2, k) = sThisTime
                    RawRslts(3, k) = sThisChip

                    frmRFID2.lstRawData.AddItem k + 1 & vbTab & LineArr(i)

                    k = k + 1
                End If
            End If
        Next i
    End If

Open in new window


Any suggestions on how to better manage this process would be much appreciated.

Note:  I have set the RawRslts array dim at 11000 to avoid any ReDim Preserve issues.  Is there a better way to do that?
SOLUTION
Avatar of Jim P.
Jim P.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Schneider

ASKER

I might be able to append the files but I really want to keep that file intact since it comes right out of the timer...kind of sacred data.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Interesting idea.  I like the idea of creating successive text files...but I can't change the fact that the original text file will have all the reads.  It is created by the third party rfid timing system.  Is there a way to use your idea and keep the original text file intact?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Very helpful.  Thank you!