Searching > Advanced Seach "Like" issue

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 5, 2013   (RSS)

Hey

Table "quote_request" has a field "quote_sent_to" which is a list/array, such as "1, 3, 6" (related to another table "installers" by 'num').

I have set up an advanced seach filter on "quote_request" so I can filter it by company:

sent|quote_sent_to

This offers a nice dropdown where I can select the installer.

However this actually produces:

[code]

FROM `cms_quote_requests` as `quote_requests`
WHERE ((true) AND (((`quote_sent_to` LIKE '%5%')

[/code]

Which causes problems because it returns where quote_sent_to = 15, 51, 52 etc, not just '5'.

Previously when ive come across this problem, I've had to use in_array - is there anything inbuilt in CMSB I can change my advanced search filter to so it'll work?

Cheers

Rob

By gregThomas - March 5, 2013

Hi Rob,

You should be able to get around this by adding the filter type to the end of the string:

sent|quote_sent_to|match

Then the search should only return exact matches.

The third option on an advanced search filter is the search type, possible options are: match, keyword, prefix, query, min, max, year, month or day.

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com