Filter by record with multiple recorded value

4 posts by 2 authors in: Forums > CMS Builder
Last Post: August 31, 2011   (RSS)

By ht1080z - August 29, 2011 - edited: August 31, 2011

Hello!

I have created multiple datafield through category table PROCAT onto the record PROOR. (example: a1,a2,a4) and i need to filter on 4 difference PHP pages, the string that you can see below, look WHERE below.

'where' => "proor = 'a2'", {{only, but not other recorded values}}

but in every page only the selected records from the same table.

<?php
$libraryPath = 'cmsact/lib/viewer_functions.php';
$dirsToCheck = array('/home/acqua/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'where' => "proor = 'a2'",
));

list($houseRecords, $houseMetaData) = getRecords(array(
'tableName' => 'house_comm',
));
$houseRecord = @$houseRecords[0];

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
));
?>


Please advise,

Re: [ht1080z] Filter by record with multiple recorded value

By robin - August 30, 2011

Hey,

So you have a multi-value field 'proor' that you want to check for only one value? If so, something like this should help:

'where' => "proor LIKE '%\ta2\2%'",

Mulit-value fields are tab (\t) separated, so we look for the value you want, surrounded by tabs.

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Filter by record with multiple recorded value

By ht1080z - August 31, 2011

Hi Robin,

I also find Dave's answer on this in the topic:
http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/Filter_by_record_with_multiple_recorded_value_P89807/gforum.cgi?post=87794;search_string=multi-value%20field;t=search_engine#87794

so i changed:

'where' => "proor LIKE '%\ta2\2%'",
to
'where' => "proor LIKE '%\ta2\t%'",
and worked perfectly.

Thank you for your support on this!