relating records on a List View page
2 posts by 2 authors in: Forums > CMS Builder
Last Post: May 25, 2011 (RSS)
By sidcam - May 24, 2011
This should be a simple/common problem, but I've been searching the forum for a few days now and can't quite find my answer.
I have two sections- contacts and companies.
Every contact record relates to an existing company record. Both sections have a field named <companyid> that ties the contacts to their appropriate company.
I want to create a list view page for the contacts section (say 20 contact records with prev/next) that also includes fields from the appropriate company record for each contact.
How do I do that?
SId/St Louis
I have two sections- contacts and companies.
Every contact record relates to an existing company record. Both sections have a field named <companyid> that ties the contacts to their appropriate company.
I want to create a list view page for the contacts section (say 20 contact records with prev/next) that also includes fields from the appropriate company record for each contact.
How do I do that?
SId/St Louis
Re: [sidcam] relating records on a List View page
By robin - May 25, 2011
Hey Sid,
If you're not comfortable with writing SQL, then you should use two getRecords(). One for each table. Here is a link to a similar situation with rentals and reviews:
http://www.interactivetools.com/forum/gforum.cgi?post=79374;search_string=list view joins;#79374
The second getRecords() needs a where condtion that uses the common field.
Something like:
Hope that helps,
Robin
If you're not comfortable with writing SQL, then you should use two getRecords(). One for each table. Here is a link to a similar situation with rentals and reviews:
http://www.interactivetools.com/forum/gforum.cgi?post=79374;search_string=list view joins;#79374
The second getRecords() needs a where condtion that uses the common field.
Something like:
'where' => 'companyid='.$contactRecord['companyid'],
Hope that helps,
Robin
Robin
Programmer
interactivetools.com
Programmer
interactivetools.com