By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,346 Members | 2,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

Updating normal and estimated values in recordset

P: 1
Hello everyone,

I have some very difficult task to accomplish using ADODB, or DAO in visual basic 6 whichever. This is my masters project and I am stuck!! Say I have a recordset with 4 customers such as:

Expand|Select|Wrap|Line Numbers
  1. Field1        Field2        Field3        Field4        Field5        Field6        Field7
  2. E        N        E        E        N        E        N
  3. E        E        E        N        E        E        N
  4. E        N        E        E        E        N        N
  5. N        N        E        N        N        N        N
  6.  
Expand|Select|Wrap|Line Numbers
  1. E=estimated value
  2. N=normal value
  3.  
The number of records are 180,000k (rows), so this cannot be done manually. Basically for rows I wish to convert estimated values into normal values. So row1 is:

Expand|Select|Wrap|Line Numbers
  1. Field1        Field2        Field3        Field4        Field5        Field6        Field7
  2. E1        N2        E3        E4        N5        E6        N7
  3.  
CONVERSION
Field 1: Converting field1 to normal value, we have to see the number of estimates before field2, since there is only one, so I need to update in such a way:

Expand|Select|Wrap|Line Numbers
  1. Field1        Field2        Field3        Field4        Field5        Field6        Field7
  2. N2/2        N2/2        E        E        N        E        N
  3.  
Then continue to the next estimated element if there is any in that row.
Field 5: Converting field3, field4 to normal value, we have to see the number of estimates after the last normal value I.e. field2 until field 5, since there are 3, so I need to update in such a way:

Expand|Select|Wrap|Line Numbers
  1. Field1        Field2        Field3        Field4        Field5        Field6        Field7
  2. N2/2        N2/2        N5/3        N5/3        N5/3        E        N
  3.  
Then continue to the next estimated element if there is any in that row.
Field 7: Converting field6 to normal value, we have to see the number of estimates after the last normal value I.e. field5 until field 7, since there is only 1, so I need to update in such a way:

Expand|Select|Wrap|Line Numbers
  1. Field1        Field2        Field3        Field4        Field5        Field6        Field7
  2. N2/2        N2/2        N5/3        N5/3        N5/3        N7/2        N7/2
  3.  
And then continue to the next row, since there is no "E" element and/or the last field of the row was achieved. Then repeat this for all the rows in the recordset.
Provided there is one constraint, if the last value i.e. Field7 is E then obviously we cannot normalize the value and update, since there is no N value next, so I can use sql to filter those records in that case (which is very frequent).

Basically, my values for E and N in the recodset are such that, I make it a bit easy:

Expand|Select|Wrap|Line Numbers
  1. E= E:<value here>
  2. N= N:<value here>
  3.  
So after I check whether it is N or E I can split the string with respect to : and using the first index, i.e. index=1 to retrieve the value from the string, and can then update it to which ever format I like.

Note the problem is the gaps between "N" and "E" are never fixed always changing, this is causing the main problem. Anyway to tackle this?? Any psuedocode or logic??

Any help regarding this type of problem. I know this is difficult. All help is appreciated.
Jul 2 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.