아래 TABLE과 같은 자료가 있을때

상위 레벨의 품목코드를 가지고 오는 방법이 있을까요?



seqLevel코드품명
11HC100A00001HYDRAULIC CYLINDER UNIT COMPLETE
2  2HC400700001HCU BASE PLATE MACHINING
3  2HC400700002HCU BASE PLATE MACHINING
4  2HC100Z00001ASSEMBLY KIT
5    3HC509900002STUD
6    3HC509900003CAM LOCK WASHER
7    3HC509900004HEXAGON NUT
8  2HC100B00001HYDRAULIC CYLINDER UNIT
9    3HC100C00001DISTRIBUTOR BLOCK COMPLETE
10      4HC300100001DISTRIBUTOR BLOCK
11          5HC600100001DISTRIBUTOR BLOCK(소재)
12      4HC509900004SCREW PLUG
13      4HC509900005SCREW PLUG
14      4HC509900006SCREW PLUG
15      4HC509900007SCREW PLUG
16      4HC509900008PARALLEL PIN
17      4HC409900001ORIFICE
18      4HC509900009SCREW PLUG
19      4HC509900010PARALLEL PIN
20      4HC409900002ORIFICE
21      4HC409900003ORIFICE
22      4HC509900011SPRING PIN
23      4HC509900012SCREW PLUG
24    3HC100D00001HYDRAULIC EXHAUST ACTUATOR
25      4HC509900013HEXAGON SOCKET BOLT
26      4HC509900004SCREW PLUG
27      4HC509900014HEXAGON SOCKET BOLT
28      4HC509900015PARALLEL PIN
29      4HC100Z00002NON RETURN VALVE
30        5HC409900004NON RETURN VALVE
31        5HC409900005GASKET
32      4HC409900006SEALING RING
33      4HC409900007SEALING RING
34      4HC300200001ONE PIECE OIL CYLINDER
35      4HC300300001TOP PIECE OIL CYLINDER
36      4HC400800001STEP 2 PISTON
37      4HC400900001STEP 1 PISTON
38      4HC401000001BOTTOM PIECE OIL CYLINDER
39    3HC100E00001FUEL OIL PRESSURE BOOSTER
40      4HC509900016SHAFT RETAINING RINS
41      4HC409900008SHAPED PLATE
42      4HC509900017SCREW PLUG
43      4HC509900018HEXAGON SOCKET BOLT
44      4HC409900009UNION NUT & PLUG SCREW
45      4HC509900019HEXAGON BOLT
46      4HC509900020HEXAGON SOCKET BOLT
47      4HC409900010HYDRAULIC CYLINDER UNIT FLANGE
48      4HC409900011ORIFICE
49      4HC409900012ROUND PACKING


예를 들면 2번째 줄의 경우 1레벨 밑의 2레벨이므로 1레벨의 코드 HC100A00001 를 가져오고

행 40-49번의 4레벨의 경우 상위 3레벨인 HC100E00001 의 값을 가져와 각각 순번을 매기고 싶습니다. 

 아래 와 같이 출력을 하고 싶습니다.


좋은 방법이 있을까요?


결과값


seqLevel코드품명모품목순번
11HC100A00001HYDRAULIC CYLINDER UNIT COMPLETEHC100A00001001
2  2HC400700001HCU BASE PLATE MACHININGHC100A00001001
3  2HC400700002HCU BASE PLATE MACHININGHC100A00001002
4  2HC100Z00001ASSEMBLY KITHC100A00001003
5    3HC509900002STUDHC100Z00001001
6    3HC509900003CAM LOCK WASHERHC100Z00001002
7    3HC509900004HEXAGON NUTHC100Z00001003
8  2HC100B00001HYDRAULIC CYLINDER UNITHC100A00001004
9    3HC100C00001DISTRIBUTOR BLOCK COMPLETEHC100B00001001
10      4HC300100001DISTRIBUTOR BLOCKHC100C00001001
11         5HC600100001DISTRIBUTOR BLOCK(소재)HC300100001001
12      4HC509900004SCREW PLUGHC100C00001002
13      4HC509900005SCREW PLUGHC100C00001003
14      4HC509900006SCREW PLUGHC100C00001004
15      4HC509900007SCREW PLUGHC100C00001005
16      4HC509900008PARALLEL PINHC100C00001006
17      4HC409900001ORIFICEHC100C00001007
18      4HC509900009SCREW PLUGHC100C00001008
19      4HC509900010PARALLEL PINHC100C00001009
20      4HC409900002ORIFICEHC100C00001010
21      4HC409900003ORIFICEHC100C00001011
22      4HC509900011SPRING PINHC100C00001012
23      4HC509900012SCREW PLUGHC100C00001013
24    3HC100D00001HYDRAULIC EXHAUST ACTUATORHC100B00001002
25      4HC509900013HEXAGON SOCKET BOLTHC100D00001001
26      4HC509900004SCREW PLUGHC100D00001002
27      4HC509900014HEXAGON SOCKET BOLTHC100D00001003
28      4HC509900015PARALLEL PINHC100D00001004
29      4HC100Z00002NON RETURN VALVEHC100D00001005
30        5HC409900004NON RETURN VALVEHC100Z00002001
31        5HC409900005GASKETHC100Z00002002
32      4HC409900006SEALING RINGHC100D00001006
33      4HC409900007SEALING RINGHC100D00001007
34      4HC300200001ONE PIECE OIL CYLINDERHC100D00001008
35      4HC300300001TOP PIECE OIL CYLINDERHC100D00001009
36      4HC400800001STEP 2 PISTONHC100D00001010
37      4HC400900001STEP 1 PISTONHC100D00001011
38      4HC401000001BOTTOM PIECE OIL CYLINDERHC100D00001012
39    3HC100E00001FUEL OIL PRESSURE BOOSTERHC100B00001003
40      4HC509900016SHAFT RETAINING RINSHC100E00001001
41      4HC409900008SHAPED PLATEHC100E00001002
42      4HC509900017SCREW PLUGHC100E00001003
43      4HC509900018HEXAGON SOCKET BOLTHC100E00001004
44      4HC409900009UNION NUT & PLUG SCREWHC100E00001005
45      4HC509900019HEXAGON BOLTHC100E00001006
46      4HC509900020HEXAGON SOCKET BOLTHC100E00001007
47      4HC409900010HYDRAULIC CYLINDER UNIT FLANGEHC100E00001008
48      4HC409900011ORIFICEHC100E00001009
49      4HC409900012ROUND PACKINGHC100E00001010