Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update single column from another table
Message
From
29/11/2001 13:30:35
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00587103
Message ID:
00587608
Views:
38
Max,

I ran this on my system and it worked, so perhaps we have something different in our setups.

The first question that comes to mind is this. What data type is the "rptdate" field in your 2 tables. I assumed it was a Date type, but a Time or character string would also be possible. Is the data type the same in both tables?

Jay

>Thanks alot for the steps Jay, I need all the directions I can get as I am really new to VFP. When I tried testing it from the command window I get an error message saying "Function argument value, type, or count is invalid". Also the debugger stops on the second to last line "SET RELATION TO emp_name .... " when running it from the form. What does it mean or have reference to? Is it a problem with the field type in one of the tables?
>
>Thanks again!
>Max
>
>>> I'll do this from scratch. Hope this isn't too basic, just wanted to avoid ambiguity. As I'm sure you know, always hit the Enter key after each command in the command window to tell VFP to execute it.
>
>>> 1. Open up both tables in the Data Session interface (from the menu option Window..Data >> Session)
>
>>> 2. Create an index on T1.
>
>* Select T1 as the current work area (press the mouse button on the line indicating T1).
>* Type the following command in the command window:
>
>INDEX ON emp_name + DTOC (rptdate) TAG PK
>
>* Order the table on the basis of that index in the command window:
>
>SET ORDER TO PK
>
>3. Set a relationship between the two tables.
>
>* In the command window, type:
>
>SELECT T2
>SET RELATION TO emp_name + DTOC (rptdate) INTO T1
>
>4. Perform the replacement.
>
>* In the command window, type:
>
>REPLACE ALL T2.commission with T1.commission
>
>That should address your update issue. The tables are still related, so before doing other operations, you may want to select T2 in the Data Session interface, and then type SET RELATION TO in the command window to disconnect them.
>
>That should work for you. Best wishes!
>
>>> Jay
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform