* Swap - Swap fields without losing data * If you replace A with B, and B with A, you will get 2 B's * You MUST have a 3rd temporary field or variable parameter cField1, cField2, lAll if type(cField1) # type(cField2) wait window 'Fields must be the same type: ' +cField1 +' # ' +cField2 timeout 3 return endif if empty(lAll) do pSwap with cField1, cField2 else nSwapped =0 scan && rest do pSwap with cField1, cField2 nSwapped =nSwapped +1 endscan wait window 'Swapped: ' +ltrim(str(nSwapped)) +' ' +cField1 +' with ' +cField2 nowait endif return .t. procedure pSwap parameter cField1, cField2 xField1 =evaluate(cField1) xField2 =evaluate(cField2) replace (cField1) with xField2 replace (cField2) with xField1