About to start a new project & looking for advice

Page 1 of 3 123 LastLast

  1. Posts : 28
    Windows 7 Home Premium 64bit.
       #1

    About to start a new project & looking for advice


    I work at a lumber yard and I have a bunch of text files (called pick lists) that start with about twenty to forty lines of pointlessness then gets to the data needed. It looks like this:
    1,2x4,16',2100
    2,2x4,14',#2
    3,2x6,12',#2
    1,2x4,10',#2
    1,2x4,16',2100
    2,2x4,14',#2
    1,2x4,10',#2
    3,2x6,12',#2
    3,2x6,12',#2
    ......
    QTY,SIZE,LENGTH,GRADE
    I'm the guy that gets handed this printout and gets to count all this out (they are much longer like 2-3 pgs.) I know I can write something, somewhere to sort through these files and just print out the added QTY of each instance of similar size, length & grade. I just don't know where to start.
    Thanks for any input
    Last edited by McP2143; 06 Jun 2011 at 17:35.
      My Computer


  2. Posts : 110
    Windows 7 Professional x64
       #2

    This could be done fairly easily with a Python script. I would be happy to write it for you, but I am extremely low on time right now. If you don't need it before June 10th, I can write it for you.
      My Computer


  3. Posts : 28
    Windows 7 Home Premium 64bit.
    Thread Starter
       #3

    Wow I didn't expect an offer to write it for me!! Thank you Brice. Waiting is not an issue at all. I was planning on teaching myself some lessons in code as I assumed this would be fairly easy. I will get a few of the full files and post them here Monday night after work.
      My Computer


  4. Posts : 110
    Windows 7 Professional x64
       #4

    No problem. Just PM me around June 9th or June 10th. It won't take too long and will be really good practice for me.
      My Computer


  5. Posts : 110
    Windows 7 Professional x64
       #5

    Can you tell me what you'd like the program to display for the sample you posted above?
      My Computer


  6. Posts : 110
    Windows 7 Professional x64
       #6

    I just finished the script. I have attached it and a sample data file. This is how it would work for the sample data you gave me above. (The file Sample Data.txt must be in the same folder as this Python script.)
    Code:
    Please enter the path to a data file: Sample Data.txt
    Size Quantities:
     2x4: 8
     2x6: 9
    Length Quantities:
     14': 4
     16': 2
     10': 2
     12': 9
    Grade Quantities:
     #2: 15
     2100: 2
    By the way, you must install Python before using this script. To do so, please click here and you will download the 64-bit version.
    About to start a new project & looking for advice Attached Files
      My Computer


  7. Posts : 28
    Windows 7 Home Premium 64bit.
    Thread Starter
       #7

    1,2x4,16',2100
    2,2x4,14',#2
    3,2x6,12',#2
    1,2x4,10',#2
    1,2x4,16',2100
    2,2x4,14',#2
    1,2x4,10',#2
    3,2x6,12',#2
    3,2x6,12',#2
    ......
    for this example an output would be

    9,2x6,12',#2
    2,2x4,10',#2
    4,2x4,14',#2
    2,2x4,16',2100

    This is a trimmed down example the real deal has many different lengths, sizes, and grades. I would also like any output of this to be in a new file. Thanks again.
      My Computer


  8. Posts : 110
    Windows 7 Professional x64
       #8

    Oh, okay. I'll make some modifications to it to do that.
      My Computer


  9. Posts : 110
    Windows 7 Professional x64
       #9

    I have now modified it to do everything you want, including putting the output in a new file. Please report back on how well this works, and please rep me if you find it useful. Thanks.

    IMPORTANT: Make sure to extract the zip file before using the script.
    About to start a new project & looking for advice Attached Files
      My Computer


  10. Posts : 2,752
    Windows 7 Pro x64 (1), Win7 Pro X64 (2)
       #10

    BriceH said:
    I have now modified it to do everything you want, including putting the output in a new file. Please report back on how well this works.
    Seems to work exactly as expected. Very nice.

    Since the input TXT file is clearly in a CSV (comma-separated variable) format that is suitable for importing into Excel, it also would seem that a spreadsheet solution with a simple SUM/DSUM function of some kind should also exist... since the data is already prepared and it's just a matter of adding the values in cells from one column based on matching cells in other columns being the criteria.

    Give me one day.

    (very simple COBOL program as well)
      My Computer


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:35.
Find Us