Where contains

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 21, 2017   (RSS)

By ciaran_mac - November 17, 2017

Hi folks,

I am having a complete mind blank at the moment.

I have a multiple of products and within that I have a list which can have many values. I want to display  all the products that contain the value 3 for the following part:

Product Type (values): <?php echo join(', ', $record['quality:values']); ?>

  list($machineryRecords, $machineryMetaData) = getRecords(array(
    'tableName'   => 'machinery',
    'where'       => 'CONTAINS("$machineryRecords.quality:values", 3)',
    'perPage'     => '9',
    'loadUploads' => true,
    'allowSearch' => false,
  ));
 

By Dave - November 21, 2017

HI ciaran_mac, 

What about: 

 'where'       => ' quality LIKE "%3%" ', // contains 3

Or if it's a multi-value field the values are tab separated so you can search like this so you match 3 and not 33:

 'where'       => ' quality LIKE "%\t3\t%" ', // contains 3

Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com