>Hi All,
>
>We would like to have a Primary index key that is based on more than 1 field. i.e. Po_no N(11), po_ln_no N(11). I know
po_no + po_ln_no will SUM() the 2 columns. We tried
PADL(TRANS(po_no), 11, '0') + PADL(TRANS(po_ln_no), 11, '0') This does not work. But we have no idea why not. We keep getting an error saying the uniqueness of the index has been violated.
>
>Can it be done? If so, what did we miss?
>
>VFP6 SP5 - The database is a standard VFP '.dbc'
>
>TIA
>Mike
Mike,
THe uniqueness error may come from either (1) deleted records or (2) records that are not deleted and actually contain duplicate data
(2) cannot be solved, you have to find them
(1) can be solved as follows provided the numbers are >= 0
alter table TheTable ;
add primary key strtran(str(po_no,11,0) + str(po_ln_no,11,0), ' ', '0') for !deleted() tag Id
Gregory