Re: Update fields in previous row from fields in current row
- From: argusy <argusy@xxxxxxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 13:57:42 +1030
Tony Girgenti wrote:
Hello Graham.<snip>
I'd like to try to explain what i want to do using the data at the end of this post.
The data is in a csv file and imported into a recordset. I don't have any need to update the data source or sort any data. It is simply read into the recordset. There is no query in the sense that i'm extracting a set of records from the source. I'm using all the records in the ascii, text, csv file.
If you look at the data , you can see that the first row has "00050-00-0" as the first field. The fourth row has "00050-00-0" as the first field. This constitutes a group of rows in the recordset, four rows.
What i want to do to the recordset is take the "000048815.40" from row four and put it into the first row after the first comma after the "37.00". So, after that copy/move, the first row would look like this:
"00050-00-0",,"27202475",037.00,000048815.40,,,Y,Y,N,Y,N
There are other fields i want to move/copy also, but that's not important here, since the idea here is to get the logic down.
Once the move/copy is done, i want to delete the fourth row then go onto to the row that has "00050-81-7" and do the same thing. As you can see, that group consists of only two rows.
I hope this helps you understand what i want to accomplish with the recordset.
I'm sorry, but the comments you are making just don't seem to apply to what i need. I hope this does not offend you in any way. I'm just having a hard time trying to figure out how your comments apply to my problem.
Thanks for all of your help so far.
Tony
"00050-00-0",,"27202475",037.00,,,,Y,Y,N,Y,N
,,"27202490",037.00,,,,Y,Y,N,Y,N
,,"27206490",035.00,,,,Y,Y,N,Y,N
"00050-00-0","FORMALDEHYDE",,,000048815.40 ,000002599 ,00027,,,,,
"00050-81-7",,"12550055",100.00,,,,N,Y,N,N,N
"00050-81-7","L-ASCORBIC ACID",,,000000275.65 ,000000016 ,00027,,,,,
"00056-81-5",,"29950551",100.00,,,,N,Y,N,N,N
,,"56567421",100.00,,,,N,Y,N,N,N
"00056-81-5","GLYCERIN",,,000007163.00 ,000000256 ,00027,,,,,
Before my wife drags me off, my suggestion is to pull the data in one line at a time from the file, push it into a dynamic array of UDTs until your "total" line arrives, extract the data from that UDT and shove it into the spot you want it, in the first UDT.
Save the current data (four lines in your example, less the last UDT array)
redim the UDT array, and start on the next group.
I think I see what you're doing - moving the "000048815.40" ( and probably the "FORMALDEHYDE" as well) into their respective slots in the first line.
UH. OH.. My wife is here, giving me the evil eye!!!
Bye!!!
Graham
.
- Follow-Ups:
- Re: Update fields in previous row from fields in current row
- From: Tony Girgenti
- Re: Update fields in previous row from fields in current row
- References:
- Update fields in previous row from fields in current row
- From: Tony Girgenti
- Re: Update fields in previous row from fields in current row
- From: Ralph
- Re: Update fields in previous row from fields in current row
- From: Tony Girgenti
- Re: Update fields in previous row from fields in current row
- From: Ralph
- Re: Update fields in previous row from fields in current row
- From: Tony Girgenti
- Re: Update fields in previous row from fields in current row
- From: argusy
- Re: Update fields in previous row from fields in current row
- From: Tony Girgenti
- Re: Update fields in previous row from fields in current row
- From: argusy
- Re: Update fields in previous row from fields in current row
- From: Tony Girgenti
- Update fields in previous row from fields in current row
- Prev by Date: Re: Update fields in previous row from fields in current row
- Next by Date: Re: Update fields in previous row from fields in current row
- Previous by thread: Re: Update fields in previous row from fields in current row
- Next by thread: Re: Update fields in previous row from fields in current row
- Index(es):
Relevant Pages
|