in reply to How to increment a sequence number for evert instance of a value?

You haven't explained what you're actually doing yet. What's a "field"? What are X and Y?

    -- Chip Salzenberg, Free-Floating Agent of Chaos

  • Comment on Re: How to increment a sequence number for evert instance of a value?

Replies are listed 'Best First'.
Re: Re: How to increment a sequence number for evert instance of a value?
by aschroh (Novice) on Jun 25, 2003 at 20:37 UTC
    My appologies in an attempt to be brief and to the point...I have made my question too vague. This is what I am doing. X one of many ID numbers. I want to loop through my file and write it to a second file checking the ID number on the way. For every UN-unique instance of the ID (say it appear 10 times throughout the file)I want to increment it's sequence number So the output might look like this ID SEQ 1 1 1 2 2 1 3 1 1 3 My problem is I just am not good enough to understand how to accomplish this unless all ID 1's were consecutive and all ID 2's were consecutive etc etc etc. aschroh
      would help if I used the code tags gees sorry about that
      ID SEQ 1 1 1 2 3 1 2 1 1 3 2 2
      This is what I want it to output. The problem is the ID aren't consecutive in my file. The question is how to write this so it looks at the ID and KNOWS 1) if it's the first time it's come up and 2) if it's not the first time what to set the SEQ number to?