This thread follows on from thread1177-1313000, as I decided that maybe I needed to import the data first and then try and update the fields as necessary....
OK - I have a table (now!) which contains the following information:
The last column is calcuated to tell me the level of detail that this line represents, so 1 is the top level, 3 a subtotal, 5 a lower level of subtotal and 7 the detail.
When I need to work out next is how to update a new column with the 'rollup' code.
So, for all of the lines with a 7, I need to add the code for the '5' line which preceeds them. And then for the 5's, to add the code for the 3 that preceeds them, and then for the 3, the code for the 1 that proceeds them.
So, I want to end up with this:
Any ideas?
Fee
The question should be [red]Is it worth trying to do?[/red] not [blue] Can it be done?[/blue]
OK - I have a table (now!) which contains the following information:
Code:
NLS S PROD_CODE LEV
----- - ---------- ----------
1 0 1 1
2 0 101 3
3 0 10101 5
4 1 934794 7
5 1 2600 7
6 1 2729416 7
7 1 2495877 7
8 1 2495869 7
9 1 90480 7
10 1 65979 7
11 1 8880002838 7
12 1 1115765 7
13 1 8880005027 7
14 1 3190535 7
15 1 2932861 7
16 1 473058 7
17 1 57117 7
18 1 247650 7
19 1 266882 7
20 1 2500684 7
The last column is calcuated to tell me the level of detail that this line represents, so 1 is the top level, 3 a subtotal, 5 a lower level of subtotal and 7 the detail.
When I need to work out next is how to update a new column with the 'rollup' code.
So, for all of the lines with a 7, I need to add the code for the '5' line which preceeds them. And then for the 5's, to add the code for the 3 that preceeds them, and then for the 3, the code for the 1 that proceeds them.
So, I want to end up with this:
Code:
NLS S PROD_CODE LEV RollUp
----- - ---------- ---------- -----------
1 0 1 1
2 0 101 3 1
3 0 10101 5 101
4 1 934794 7 10101
5 1 2600 7 10101
6 1 2729416 7 10101
7 1 2495877 7 10101
etc
Any ideas?
Fee
The question should be [red]Is it worth trying to do?[/red] not [blue] Can it be done?[/blue]