Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set relation to

Status
Not open for further replies.

alank01

Programmer
Jun 11, 2001
21
US
i have a question on set relation. i have as an example a client table and a contacts table (ccontacts). the client field exits in both tables so a simple browse might be.

use ccontacts order client
use clients in 0
set relation to client into ccontacts
set skip to ccontacts && one to many contacts

brow fields client,ccontacts.name, ccontacts.status

ccontacts table also has a field <status>. this is a numeric field. i would like to browse contacts with lets say only status of 0. can i set a relation that will accomplish this? i tried selecting ccontacts and set filter to status = 0 but this did not seem to work? any suggestions other than using select * from or a view. i would like to use the SET RELATION TO <expr> if possible. thanks

 
Try this:

BROWSE fields client,ccontacts.name, ccontacts.status ;
FOR ccontacts.status=0

Ian
 
You can't BROWSE fields from multiple tables in a single browse without using SELECT.....
One thing to note though, is that you need to set your relation and skip, after you set the filter.

Dave S.
 
Note: You can also do this with a SET FILTER:
[tt]
SELECT Clients
SET FILTER TO ccontacts.status=0
[/tt]
Note that, even though the filter is &quot;ccontacts.status=0&quot; the filter is actually applied to the Clients table.

Ian
 
I will now retract my statement:
&quot;You can't BROWSE fields from multiple tables in a single browse without using SELECT.....&quot;
You need to preface all fields to be browsed with alias though:

BROWSE fields client.field1, client.field2..., ccontacts.name, ccontacts.status ....

So sorry. I thought it was not doable without SELECT...

Dave S.
 
thanks ian that browse ...for did the trick. i guess i was too focused on the set relation to command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top