Page 1 of 1

Copy field data in customer screen

Posted: Thu Feb 08, 2007 9:07 pm
by Dyna
I have created two user fields in the customer screen -
Accounts Contact
Accounts Phone
I would like to be able to copy the existing data in CUSCONTACT and CUSPHONE to these fields for all existing customers.

In future I would like to be able to do follg at time of adding new customer: if the 2 user fields are empty then copy the data from CUSCONTACT and CUSPHONE to these fields.

What is the best way of doing this.

Posted: Fri Feb 23, 2007 4:23 pm
by COBS Tech Support
For moving fields within the database do the following:

1. Make a copy of the file CUAUX000.DBF which contains your user field information. Do this when nobody is logged into CAPITAL.
2. Load the copy of this file into Excel.
3. Remove any columns you don't want and save the file as a comma or tab delimited ASCII file.
4. Start INSTALLATION Workshop, go to Transfer, Import External File, Customer Accounts.
5. Import the data file into the fields you want.

To conditionally copy fields when adding new records, do the following:

1. Start INSTALLATION Workshop, Build, Screen Builder. Ensure all users are logged out of the system.
2. Open the customers screen.
3. Select File|Screen Script
4. Assuming the Screen Script is empty, add these instructions:

Code: Select all

If Mode = 3
   If IsEmpty(SCRRead("ABC"))
      SCRWrite("ABC", SCRRead("DEF"))
   Endif
Endif


Repeat the inner If ... Endif statements for each field you want to copy into a subsequent field. Change ABC to the name of the field you want to copy into. Change DEF to the name of the field you want to copy from.

For example, to copy 2 fields:

Code: Select all

If Mode = 3
   If IsEmpty(SCRRead("ABC"))
      SCRWrite("ABC", SCRRead("DEF"))
   Endif

   If IsEmpty(SCRRead("GHI"))
      SCRWrite("GHI", SCRRead("JKL"))
   Endif
Endif


5. Save your changes.