Search with OR option December 03, 2019, 11:31:43 AM Hi,i have an issue on a list page search Field.i have in a db field named faq_problem some text: examp. "error on row rp8"if i search 'error rp8' not record displayed.if i search 'error % rp8' wil show the record.if i search 'rp8 % error' not record displayed.How i can edit the search function?the sql is like this: SELECT * FROM table WHERE (name LIKE '%value1%') OR (name LIKE '%value2%') ORDER BY id ASCthx. Quote Selected Last Edit: December 03, 2019, 12:13:34 PM by alekib
Re: Search with OR option Reply #1 – December 03, 2019, 01:41:33 PM @alekib please check the image below for reference.1. For a List Page, you can configure the fields you want the search to match against on that page, by checking the fields checkbox and unchecking any field checkbox you don't want to add to the search2. Use the SearchType to set the type of search you want to use in each field when searching. Note that this will depend on if you enabled the Search by checking the checkbox. Quote Selected
Re: Search with OR option Reply #2 – December 03, 2019, 02:19:12 PM Hi willvin,thanks for reply but your answer dont fix my issue.Still not filter record if i invert the search terms.i have found this code but i dont know ho to implement this on list page search fields$str = yourinput;$strarray = (explode(" ",$str));$query = "SELECT * FROM table WHERE ";Foreach($strarray as $key=>$value){If($key > 0){$query = $query . "OR";}$query = $query . " (name LIKE '%" . $value . "%') ";}$query = $query . "ORDER BY id ASC"; Quote Selected
Re: Search with OR option Reply #3 – December 03, 2019, 07:44:46 PM @alekib currently there is no configuration for that, you will need to edit your project manually after publishing it. Quote Selected
Re: Search with OR option Reply #4 – December 05, 2019, 10:02:37 AM Quote from: willvin – December 03, 2019, 07:44:46 PM@alekib currently there is no configuration for that, you will need to edit your project manually after publishing it.Ok. Can you explain me where is the file to be edit with new custom sql?Thx. Quote Selected
Re: Search with OR option Reply #5 – December 05, 2019, 03:59:59 PM @alekib please locate the controllers folder in app/, there you will see a list of controllers, find and open the page controller you want to work on, the file name will start with the page name followed by controller.php(e.g InventoryController.php). in the list() function you can now edit it to do what you want. Quote Selected