[TYPO3] wfqbe (DB integration) and multiple select options

Mauro Lorenzutti mauro.lorenzutti at webformat.com
Wed Sep 26 17:57:58 CEST 2007


Hi bhoft,


> Hi, 
> I am trying to create a search option with multiple static values, which
> should be searchable in a mysql table with the column type 'set' the values
> could be e.g. ('type 1', 'type2' ... ' type10' ..).
> 
> The searchform should have a checkbox group so multiple set values should be
> listed in the result.
> So my problem is how do I create the select Query table object to get the
> right sql query?
> I tried the options 'in' 'like' and so on.
> 
> the 'like' search option would work, but in case of same texts the like
> '%type 1%' would also find the entries with 'type 10' set in the database
> and this also if I only search for 'type 1' and not multiple values like
> ('type 1', 'type x' ) in case I select multiple checkbox as searchoptions on
> my searchform.
> 
> A good select query would be:
> SELECT *
> FROM `tablename`
> WHERE FIND_IN_SET( 'type 1', set_column ) >0
> OR FIND_IN_SET( 'type 10', set_column ) >0
> LIMIT 0 , 30;


If I understood correctly, you have a field (let's call it 
"column_field") that can contain 1 specific value. Then you have a list 
of values and you want to provide a multiple checkbox selection to allow 
users to search every record where the column_field contain one of the 
selected values. Is it right? In this case I suggest you this query:

SELECT *
FROM tablename
WHERE column_name IN (###WFQBE_LISTVALUES###);

Not tested but I think it works...


> 
> I also tried to extend the form generator class, but because the query is
> only filled up with the values on the placeholders. So this isn't what I
> want.
> 
> Is there another way to extend or modify the select for a specific
> searchoption?
> I read about hooks, but for me its not clear how and where this hooks are
> created.


Search for
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['wfqbe']
inside the source code and you'll find where the hooks are called.

Regards,
-- 
  Mauro Lorenzutti


e-mail:  mauro.lorenzutti at webformat.com

---------------------------------------------------------
WEBFORMAT srl | Corte Europa, 12 | I-33097 SPILIMBERGO PN
      Tel +39-0427-926.389  --  Fax +39-0427-927.653
        info at webformat.com  --  http://www.webformat.com
---------------------------------------------------------


More information about the TYPO3-english mailing list