Sort records based on dragSort of another table

4 posts by 3 authors in: Forums > CMS Builder
Last Post: April 20, 2011   (RSS)

Re: [rjbathgate] Sort records based on dragSort of another table

Hi Rob,

I did a search on sortby dragsortotrder and found some interesting posts, including this one:

http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/gforum.cgi?post=85670

Hope that offers some insights.

Good luck,

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] Sort records based on dragSort of another table

Hey,

Thanks for the thread Jerry.

Unless I'm missing something however it doesn't cover sorting one table of records based on the order of linked records in a second table, which is the issue I'm having.

Cheers
Rob

Re: [rjbathgate] Sort records based on dragSort of another table

By Dave - April 20, 2011

Hi Rob,

There's an efficient way, and a simple way, but not both.

The simple way is to do lots of queries. Just load Discipline, sort it by dragSort and output it, then in the foreach load courses that match that discipline. So you get many many getRecords() calls, but if your database isn't too big you can probably get away with it.

The efficient way is to write a pure MySQL query with a JOIN and sort on that, but that will take some experimenting.

You can do a lot with the viewer functions but things like this are still often easier done by hand.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com