3 tables linking problem

A place for users and developers of the Xataface to discuss and receive support.

3 tables linking problem

Postby brokenclock » Wed May 27, 2009 7:51 am

Hi,

It's been a long time that I did not play with Xataface, and I am still a newby at it. So, please, excuse-me if my question seems dumb.
I've have 3 tables : clients, contacts, actions.
actions and contacts have a client_id field pointing to the id field of the client table, defined in fields.ini and valuelists.ini files.
I defined a relationships.ini in the clients directory. So I have the 2 great tabs in the clients page.
But i also have an contact_id field on the actions table, pointing to contact.id, defined in fields.ini and valuelists.ini files.
Great.
When I use the actions tab of the clients page to add a new action, I see a select field with ALL my contacts.
The problem is that I only want to see the contacts with the field client.id set to the current client.

How can I do that?

Best regards,

BrokenClock
brokenclock
 
Posts: 12
Joined: Tue Sep 30, 2008 7:16 am

Postby silma » Tue Jun 02, 2009 1:19 am

Hello,

Maybe the valuelist function could help you ?

http://xataface.com/forum/viewtopic.php?t=3961
silma
 
Posts: 87
Joined: Tue Apr 28, 2009 11:47 pm

Re: 3 tables linking problem

Postby shannah » Tue Jun 02, 2009 10:22 am

brokenclock wrote:Hi,

It's been a long time that I did not play with Xataface, and I am still a newby at it. So, please, excuse-me if my question seems dumb.
I've have 3 tables : clients, contacts, actions.
actions and contacts have a client_id field pointing to the id field of the client table, defined in fields.ini and valuelists.ini files.
I defined a relationships.ini in the clients directory. So I have the 2 great tabs in the clients page.
But i also have an contact_id field on the actions table, pointing to contact.id, defined in fields.ini and valuelists.ini files.
Great.
When I use the actions tab of the clients page to add a new action, I see a select field with ALL my contacts.
The problem is that I only want to see the contacts with the field client.id set to the current client.

How can I do that?

Best regards,

BrokenClock



Can you post your relationships.ini file. There is likely a problem with the definition of your actions relationship.[/url]
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

relationship.ini

Postby brokenclock » Tue Jun 02, 2009 11:54 am

here clients/relationship.ini
Code: Select all
[contacts]
contacts.client_id = clients.id
[actions]
log.client_id = clients.id

Hope this help!
brokenclock
 
Posts: 12
Joined: Tue Sep 30, 2008 7:16 am

Postby shannah » Tue Jun 02, 2009 12:55 pm

Change it to:
Code: Select all
[contacts]
contacts.client_id = "$id"
[actions]
log.client_id = "$id"
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Same thing

Postby brokenclock » Wed Jun 03, 2009 1:02 am

I tried, but things remain the same.
I think that part of the problem stands in the log/valuelists.ini, I did not know how to set the vocabulary to get the corresponding contacts. Currently, it is:
Code: Select all
[contact]
__sql__  = "SELECT id, nom FROM contacts"

which works fine when you want to add an action from the action tab and you do now have any client selected.
I've tried many times to set it differently to get only the client's contacts when there is a client selected, but dit not find the correct way. For example:
Code: Select all
[contact]
__sql__  = "SELECT id, nom, client_id FROM contacts WHERE client_id = '$id'"

Should I use the valuelist function as silma suggests?[/code]
brokenclock
 
Posts: 12
Joined: Tue Sep 30, 2008 7:16 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 22 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved