Categories for Dummies - Multi Category, Multi Records Help

7 posts by 2 authors in: Forums > CMS Builder
Last Post: August 6, 2010   (RSS)

Re: [crazyfish] Categories for Dummies - Multi Category, Multi Records Help

By Jason - August 6, 2010

Hi,

The category field in your Studies & Reports table, is it a multi-select drop down? If it is, the problem is CMS Builder stores multiple selects as a list of values separated by a tab character (\t). If you're trying to get records who's category equals "1", try something like this:

// load records
list($studies_reportsRecords, $studies_reportsMetaData) = getRecords(array(
'tableName' => 'studies_reports',
'perPage' => '10',
'loadUploads' => '0',
'allowSearch' => '0',
'where' => "category LIKE '%\t1\t% ' ",
'orderBy' => 'publish_date DESC',
));


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Categories for Dummies - Multi Category, Multi Records Help

By crazyfish - August 6, 2010

The field type is a list, checkboxes ( multi value )
Would that matter?

Re: [crazyfish] Categories for Dummies - Multi Category, Multi Records Help

By Jason - August 6, 2010

Hi,

CMS Builder will store multi value check boxes and multi value lists the same way. It should still work. Give it a try and let me know if you run into any problems.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Categories for Dummies - Multi Category, Multi Records Help

By crazyfish - August 6, 2010

No luck, in fact it comes up as no records as in the error "There are no current updates"

Re: [crazyfish] Categories for Dummies - Multi Category, Multi Records Help

By Jason - August 6, 2010

Hi,

Make sure there is no spaces between the % and the '
So it looks like this:
'where' => "category LIKE '%\t1\t%' ",

Give that a try. If this doesn't work, please attach a copy of the .php file you're working with so I can take a closer look.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Categories for Dummies - Multi Category, Multi Records Help

By crazyfish - August 6, 2010

That's the trick. So much for cut and paste!
Thanks for the help, you guys are great.