Changing Lot Numbers in a CSV file depending on sequence

This forum is for posting code that needs help.

luiscasanova
Posts: 6
Joined: Tue Sep 08, 2009 4:46 pm

Changing Lot Numbers in a CSV file depending on sequence

Post by luiscasanova »

Greetings everyone.

I have a problem and I need to write a program to solve it. I was going to try and figure it out myself, but I'm running out of time and I have very little experience programming and is job-related, so I need to get it done asap. Here's the thing: I need to process a csv file every week in a custom program at work. When you open this file in excel it shows you two columns:

Column A is the lot, Colum b is the sequence. The problem is that our provider changed some of the lot numbers, but our database still has the old lot numbers. We can

not change them in our program. I tried changing them in excel but is not as easy as it seems, because the new lots depend also on the sequence numbers.


These are the guidelines to change the lots ( new lot to old lot)

Lot Seq Begin Seq End New Lot
7065362 10029501 10030000 7069482
7065362 10029351 10029500 7069482
7065362 10008001 10008150 7069482
7067882 10013001 10015000 7069482
7067882 10006501 10007000 7069482
7065362 10008501 10010000 7069482
7067882 10017501 10018500 7069482

7067882 10007501 10009000 7069642

7067882 10010501 10011500 7069482
7067882 10019501 10020000 7069482

7067882 10020001 10021500 7069482


Lot Seq Begin Seq End
7065373 10003751 10004000 7069493

7067893 10003501 10004500 7069653

7065373 10005001 10005500 7069493
7065373 10004501 10004850 7069493
7067893 10006001 10006500 7069493
7065373 10014501 10015000 7069493

Today I found out the hard way that last week I made a mistake changing 70 lot numbers.
I'm uploading a csv file with the lots and sequences (13,935 records). Also posting the VERY little code I have written so far, basically a GUI and a buttons to load the file, run the program and exit .

I appreciate any kind of help I can get.

Thanks in advance.

Code: Select all

'This programs reads a csv file with batch and sequences and changes values acording to preset rules.
'Batch changer copyright 2012 by Luis Casanova


    nomainwin

    WindowWidth = 550
    WindowHeight = 410

    button #mainWindow.buttonOpen, "Open", [buttonOpenClick], UL, 66, 51, 42, 25
    button #mainWindow.buttonRun, "Run", [buttonRunClick], UL, 66, 211, 42, 25
    button #mainWindow.buttonExit, "Exit", [buttonExitClick], UL, 286, 211, 42, 25
    statictext #mainWindow.staticTextFileName, "Working With File:", 78, 91, 400, 20

    open "Lot Changer By Luis Casanova" for window as #mainWindow
    print #mainWindow, "font ms_sans_serif 0 16"
    print #mainWindow, "trapclose [exit]"


[mainWindow.inputLoop]   'wait here for input event
    wait

[buttonOpenClick]

    filedialog "Open CSV file", "*.csv", fileName$

    if fileName$<>"" then
        open fileName$ for input as #f
        PRINT #mainWindow.staticTextFileName, "Working With File: " ; fileName$'do stuff
        close #f
    else
        notice "No file chosen!"
    end if

    wait

[buttonRunClick]   'Perform action for the button named 'buttonRun'

'Insert your own code here
    wait


[buttonExitClick]   'Perform action for the button named 'button3'

    confirm "Do you want to quit LotChanger?"; quit$

    if quit$ = "no" then wait

    close #mainWindow


    wait




[exit]

    confirm "Do you want to quit LotChanger?"; quit$

    if quit$ = "no" then wait

    close #mainWindow

    end
You do not have the required permissions to view the files attached to this post.
stpendl
Site Admin
Posts: 60
Joined: Wed Jan 18, 2006 10:05 pm
Location: Austria

Re: Changing Lot Numbers in a CSV file depending on sequence

Post by stpendl »

This is a files archive, so people are seldom here for discussion.

It is better to post the problem at http://justbasic.conforums.com/ and only upload the file here for reference.
Stefan
The invisible Admin
luiscasanova
Posts: 6
Joined: Tue Sep 08, 2009 4:46 pm

Re: Changing Lot Numbers in a CSV file depending on sequence

Post by luiscasanova »

Thanks.

It's been a long time.