Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Skip record in child table
Message
From
10/11/2003 12:00:29
 
 
To
10/11/2003 05:53:57
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00848202
Message ID:
00848375
Views:
14
>I have Form with Parent and Child table linked with Relation.
>When I do SKIP 1 for child table it moves to next record regardless of a relation with a parent table.
>I want to do SKIP in Child table only with records that are related to Parent table.
>How?

You want a one-to-many relationship, but the default of SET RELATIONS is one-to-one. Use the SET SKIP TO command in combination with the SET RELATION command to do what you want. For example, try the following program (assuming you've installed the sample data):
CLOSE DATABASES ALL
USE (HOME()+'SAMPLES\TASTRADE\DATA\Orders.DBF') IN 0
USE (HOME()+'SAMPLES\TASTRADE\DATA\OrdItems.DBF') IN 0 ORDER Order_ID
SELECT Orders
SET RELATION TO Order_ID INTO OrdItems
SET SKIP TO OrdItems
SCAN FOR Order_ID = "     2"
  ?OrdItems.Order_ID, OrdItems.Product_ID, OrdItems.Quantity
ENDSCAN
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform