Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set relationship
Message
De
07/02/2014 10:38:36
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01593576
Message ID:
01593632
Vues:
41
>>>>
>>>>Is there a better quicker way to do this with SQL? I know I can use set relation with 2 tables. But the help in VFP 9 does not say much about additive, although I
>>>>suppose it must be what it sounds like.
>>>>
>>>>Thanks, Steve
>>>
>>>
>>>CLOSE ALL
>>>SELECT 1
>>>USE table4
>>>INDEX on mindex TO g
>>>SELECT 2
>>>USE table5
>>>INDEX on mindex TO gg
>>>SELECT 3
>>>USE table6
>>>INDEX on mindex TO ggg
>>>SELECT 4
>>>USE table7
>>>INDEX on mindex TO gggg
>>>SELECT 5
>>>USE table8
>>>INDEX on mindex TO o
>>>SELECT 6
>>>USE table9
>>>INDEX on mindex TO oo
>>>
>>>SELECT 1
>>>SET RELATION TO mindex INTO table5 additive
>>>SET RELATION TO mindex INTO table6 additive
>>>SET RELATION TO mindex INTO table7 additive
>>>SET RELATION TO mindex INTO table9 additive
>>>SET RELATION TO mindex INTO table10 additive  && after 4 set relation's, foxpro says the following: Table10 is not found
>>>
>>
>>You don't need all these Index commands, if you do it right. Open these tables, one by one, in the command window. Then issue the command "Index on mindex tag mindex". Once you have done this, these index tags will be automatically updated.
>>
>>To use the tables afterwards, you use the command "Use table1 order mindex in 0". This syntax also makes the command "Select x" commands redundant.
>>
>>Having said that, I also suggest using SQL commands instead whenever possible.
>
>Is this the kind of thing you mean?
>
>
>CLOSE ALL
>Use table4 IN 0  ALIAS t4
>USE table5 IN 0  ALIAS t5
>USE table6 IN 0  ALIAS t6
>Index on mindex tag mindex
>SELECT t4     && at this point, if I try a "Use table1 order mindex in 0"  I get a "table or file already open" type message"
>REINDEX
>
>
>But at this point the set relation commands are not really performing? I can issue:
>
>
>SET RELATION TO mindex INTO t5 additive
>SET RELATION TO mindex INTO t6 additive
>
>
>But the following don't work as expected
>
>
>browse fields t4.mindex, t5.mindex, t6.mindex   && each row going across should all have the same value, but they no longer do?
>
>
>Thank you, Steve

You still have the command "Index on mindex tag mindex" which should not go into the program. Do this ONCE for each table in the command window, and forget about it, from now on VFP will take care of these index files automatically.

If you really want to use all the Set relation stuff, this is the way:
Close all
Use table1 ALIAS t1 order mindex && This work area will stay the the current one until you Select another one
USE table2 IN 0  ALIAS t6 order mindex
USE table3 IN 0  ALIAS t5 order mindex
Use table4 IN 0  ALIAS t4 order mindex
Use table5 IN 0  ALIAS t3 order mindex
Use table6 IN 0  ALIAS t2 order mindex
*Select t1 && This line is NOT necessary, since t1 is already selected in the first line. I put it here only to inform you.
SET RELATION TO mindex INTO t2 
SET RELATION TO mindex INTO t3 additive
SET RELATION TO mindex INTO t4 additive
SET RELATION TO mindex INTO t5 additive
SET RELATION TO mindex INTO t6 additive
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform