Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set order to Child record ??
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00735091
Message ID:
00735096
Views:
9
Hi Enry,

You could have a multi-field index on the child table that could be used to set a relationship into a parent table.

For example Create child index:

select child_table
index on str(parent_id,8,0)+str(another_field) tag main of child_table.cdx
set order to tag main

Now create parent index:

select parent_table
index on str(unique_id,8,0) tag key_no of parent_table.cdx candidate
set order to tag key_no

Now set relation:

select parent_table
set relation to unique_id into child_table

Note: You can have a one-to-many relationship in a form as per above, even if a persistent one-to-many relationship has been established in a database. The one-to-many relation established in the database is usually used to enforce referential integrity.

If using a form, the above code would work well in the load event. However, the indexes would need to already be in place; otherwise, you would need to have exclusive use of the tables to create the indexes.

Please check the syntax as I'm in Linux right now and I am not able to verify syntax.

LelandJ
Leland F. Jackson, CPA
Software - Master (TM)
smvfp@mail.smvfp.com
Software Master TM
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform