8 years ago
3
Topic

Hi,

Working with tables of thousands of rows, I use the "Search Query" field which gives results (Name, Firstname) on Free tables. Ok.

Now, I'd like to have a Search field on top that would allow to find all the rows with taht name.

How do I modifiy the SQL Statement :

  SELECT Name, Firstname FROM #__customers ORDER BY 1, 2

to narrow the search to the input of the search box.

Something like 

  SELECT Name, Firstname FROM #__customers WHERE Name LIKE '%#sr_name#%' ORDER BY 1, 2

  sr_name being the name of the search field.

(but that does not work).

I need to show all on landing, and then only the searched names.

Get a Book for SEBLOD
8 years ago
2
Level 1

I found that this works

  SELECT Name, Firstname
  FROM #__customers
  WHERE [MATCH]Name||$uri->getValue('sr_name')[/MATCH]
  ORDER BY 1, 2

This is inspired from Examples 2 & 3 of http://www.seblod.com/resources/tutorials/using-the-search-query-field-plugin

Is there somewhere a documentation that, beyond examples, gives an insight of the use of variables inside Search Queries?

For instance [MATCH] generates a " LIKE '%blabla%' " (the fields that contain blabla)

How can I generate a " LIKE 'blabla%' "?  (the fields that begin with blabla)

154 Posts
WebOne
8 years ago
1
Level 2

Maybe you are looking for something like this ?

http://www.pulsar-informatique.com/telechargements-gratuits/autocomplete-field-plugin

8 years ago
0
Level 3

Yes. Thank you for the link.

Get a Book for SEBLOD