Linked tables in CMSB

4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 15, 2010   (RSS)

By garyhoffmann - March 15, 2010

Hello,
I'm wondering if something I would like to be able to do can be done from within CMSB.

I would like to create linked tables. I would need this both at the CMSB admin level and the website display level.

What I mean can best be described by an example.

Assume I have a company that specializes in trainings. For these trainings, they have trainers. Each training may be able to be done on multiple dates.

What I would like to be able to do is create a table for the trainer (TrainerTable).

1. Bob Smith - Bob's bio...
2. Gary Anderson - Gary's bio...
3. Fred Jones - Fred's bio...

Then, I'd like to have a table for the course descriptions (CourseDescriptions):

1. Course 1 - Course description...
2. Course 2 - Course description...
3. Course 3 - Course description...

Finally, I'd like to have a table that ties these together by date (OfferedClasses):

1. June 10th, Course 1, Trainer 2
2. June 15th, Course 2, Trainer 1
3. July 1st, Course 3, Trainer 3
4. July 12th, Course 2, Trainer 2
5. July 27th, Course 1, Trainer 3
6. August 5th, Course 3, Trainer 1

So, while maintaining the OfferedClasses table, I would like the admin to have a drop-down list of Courses and Trainers while creating the offered classes.

Then, on the site, I would want to display the OfferedClasses in a table fashion with links from the Course name to the Course Description and from the Trainer name to the Trainer's bio.

Is this possible in CMS Builder without custom code? I know I can do anything at the website level I need with custom code, it's more the admin part that I wonder about.

Thanks in advance.
Gary.

Re: [garyhoffmann] Linked tables in CMSB

By gkornbluth - March 15, 2010

Hi Gary,

This is by far not a complete solution, but you can easily create drop down lists with data pulled from other tables.

The easiest way might be to set up your drop down lists is to use the advanced "get options from database" function when creating your list field(s).

You get to choose the source table and fields for each list from your existing tables (so you'd have to create the multi-record "Trainers" and "Descriptions" tables first).

When the admin creates a record in the "offered classes" table, he or she would then choose the appropriate values from the lists. Those values would be from the records in the other tables.

You'd then echo those "list" fields in your viewer as required.

If you need more info, let me know.

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Linked tables in CMSB

By garyhoffmann - March 15, 2010

Oh my goodness, I hadn't even seen that feature before (but I have to say I haven't looked for it before either). Do you know if the generated viewer code will have links or do I need to create those manually (to get to the bios and course descriptions)?

Thanks,
Gary.