Page 1 of 1

MAC script transfer data from one field to another

Posted: Fri Feb 10, 2006 10:24 am
by Garry Vajda
capital Office 2.75 MAC script required.
For all stock, copy the contents of Stock->Location field to a custom Stock_Field and then delete contents of the Stock->Location field

Posted: Wed Feb 15, 2006 8:20 am
by COBS Tech Support
Try the following script. It is recommended that before running the script you go the Stock Control area to open all the required tables.

* Copy stock field to user field
Stock->(GotoTop())

:Loop
If Stock->(EOF())
Goto End
Endif

* Try to find user fields record & if it
* doesn't exist, create it
If .Not. STAUX000->(Find(StockID()))
STAUX000->(AddRecord())
STAUX000->Auxkey := StockID()
Endif

* Lock the record so it can be changed
* Copy field 'Location' into 'User1'
If STAUX000->(LockRecord())
STAUX000->User1 := Stock->Location
Endif

STAUX000->(UnlockRecord())

* Move to next record
Stock->(Skip())
Goto Loop

:End

Echo("Done")