The standard "swap" alogrithm used throughout many different programming languages can be used:
To swap values between field1 and field2:
Set Variable [$Temp ; Value: YourTable::Field1]
Set Field [YourTable::field1 ; YourTable::Field2]
Set Field [YourTable::field2 ; $Temp ]
That can be extended to "swap" between multiple address fields, but if you put these addresses in separate related records, all you need "swap" are the values in the match fields that link your current record to shipping and billing address records.
Thanks i will give that a go.
I tried this and it does as you said but it does cause me another problem.
It swaps the address on all orders not just the order i am in any ideas?
Sounds like you are swapping data in the contacts record instead of the order record. If you swapped data in the order record, the other records would remain unmodified.
This is the script i have used
Set Variable [ $Temp; Value:order_ADDRESS_pickup::__kp_addressID]
Set Field [order_ADDRESS_pickup::__kp_addressID; order_ADDRESS_destination::__kp_addressID]
Set Field [order_ADDRESS_destination::__kp_addressID; $Temp]
This script changes all instances of an address used on all orders have i done something wrong or do i need to find another way to do this.
Thanks for your help
It looks like you have relationships that are not set up to make the "swap" work like you want. You are not modifying values in Orders, but in the related tables and thus the change appears for all Orders records.
You would need these relationships:
Address_pickup::__pkAddressID = Orders::_fkAddressPUID
Address_Destination::__pkAccressID = Orders::_fkAddressDestID
Set Variable [ $Temp ; Value: orders::__kp_addressPUID]
Set Field [orders::__kp_addressPUID ; Orders::_fkAddressDestID]
Set Field [Orders::_fkAddressDestID ; $Temp]
Note that all changes have are made in the orders table.