Displaying content from one table in another while in CMSB

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 10, 2014   (RSS)

By Joseph - March 10, 2014

Is it possible to display content from one table in another whilst viewing in CMSB. 

For eg. i am trying to create a CRM so i have created 2 tables one for the Company the other for Employees. 

i have an employee called John Doe who works for Western Digital. 

when i open John Doe's record i would like to see the name of the company he works for plus all of the data held for that company for eg. Company Name, Address, Phone number, website etc etc.

I hope the above makes sense

Joseph

By gregThomas - March 10, 2014

Hi Joseph, 

This sounds like you're looking to set up related records. A related records field allows you to list records from another table that have a num value stored from the current record in another table. Here is a quick tutorial on how I set up a related record for my car/brand sections in my test CMS.

Firstly, a car has a brand record, and brand is chosen via drop down list (see list-settings.png). 

Next I create the related record field. To do this click the add field button while editing the section that needs to contain the extra records, in this example that is the brands section  (see add-a-field.png).

Next I set up the related record field, I select the cars section from the drop down, and then  update the MySQL where statement field with the field that stores the brand against each car (see related-record-field.png). I also checked the list action fields for the things I want users to be able to do from the list. In your case you might only want view.

Finally, I go to the brands section and view a brand record. Now my related records field lists all of the cars that are in that brand (see final-result.png).

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Joseph - March 10, 2014

Hi Greg

Excellent got it to work. 

I am looking to creating a CRM system to track all my advertisers etc. 

Joseph

By Joseph - March 10, 2014

Hi Greg

How did you create those blue tabs on the left hand side for your sections editors?

Joseph