Create 3 separate fields from one

S

SYDNEY02

I have a table with an item field that can consist of an item #, a sub
assembly item #, and sub-sub assembly item # separated by periods. I need to
break this up into three separate fields. The original field may only have
item #, or it could have item# & sub, or item#, sub & sub_sub. Data examples:

ORIGINAL TABLE
FIELD:ITEM
01
01.01
01.01.01
01.01.02
01.02

NEW TABLE
FIELD: ITEM SUB SUB_SUB
01
01 01
01 01 01
01 01 02
01 02
 
R

Ron2006

I have a table with an item field that can consist of an item #, a sub
assembly item #, and sub-sub assembly item # separated by periods. I need to
break this up into three separate fields. The original field may only have
item #, or it could have item# & sub, or item#, sub & sub_sub. Data examples:

ORIGINAL TABLE
FIELD:ITEM
01
01.01
01.01.01
01.01.02
01.02

NEW TABLE
FIELD: ITEM SUB SUB_SUB
01
01 01
01 01 01
01 01 02
01 02

select len(field.item)
case 2
newitem = field.item
case 5
newitem = left(field.item,2)
newsub = right(field.item,2)
case 8
newitem = left(field.item,2)
newsub = mid(field.item,4,2)
newsubsub = right(field.item,2)
end select


Ron
 
Top