Can list results usng 'orderBy' => 'RAND()', be altered by having High Priority records?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 16, 2016   (RSS)

By kkegans - September 13, 2016

I have a slideshow that is being populate with list records. There are more records that the user wants displayed, so we are limiting the output and generating the records randomly.

Now the client would like the ability to set a priority on one record so that that record will always display as the first item in the list.  Is this possible, and if so could someone steer me in the right direction? My PHP ability is severely limited.

CMSB Rocks!



Thanks,



Kurt

By Dave - September 16, 2016

Hi Kurt, 

What about something like this in the viewer getRecords code?

'orderBy' => "num = 57 DESC, RAND() ", // sort record 57 first, then random

Or if you have a checkbox for "featured" to show them first: 

'orderBy' => "featured DESC, RAND() ", // sort featured first, then random

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com