Page 1 of 1

Lookup Filter

Posted: 2018-07-20 20:58
by rprevost
Hello to you all,
Using 5.72
sorry to bother you with this 'trivial' problem.
I am trying to filter a lookup list.
The filter is on a field named actif in the equipe table.
the field actif is a varchar of length 3
In phpMyAdmin, the field actif has been set to index

PROBLEM : On click over the field in detail view, I get the spinning "gizmo" which runs forever without displaying the list (7 items in the table and 6 should be displayed with the filter)

The SQL is:
-----------------
SELECT `equipe`.`id`, IF(CHAR_LENGTH(`equipe`.`nom`) || CHAR_LENGTH(`equipe`.`id`), CONCAT_WS('', `equipe`.`nom`, ' / ', `equipe`.`id`), '') WHERE `equipe`.`actif` != 'Non' FROM `equipe` ORDER BY 2
------------------
I tried with:
-------------------------
SELECT `equipe`.`id`, IF(CHAR_LENGTH(`equipe`.`nom`) || CHAR_LENGTH(`equipe`.`id`), CONCAT_WS('', `equipe`.`nom`, ' / ', `equipe`.`id`), '') WHERE `equipe`.`actif` = 'Oui' FROM `equipe` ORDER BY 2
------------------
What I am doing wrong here?
Regards

Re: Lookup Filter

Posted: 2018-07-20 21:24
by pbottcher
Hi,

can you run the query in phpMyAdmin and see if the query delivers the correct results?

Re: Lookup Filter

Posted: 2018-07-20 21:28
by rprevost
Sorry, my stupid mistake.
I put the WHERE statement before the FROM statement.
The following works great
-------------------------
SELECT `equipe`.`id`, IF(CHAR_LENGTH(`equipe`.`nom`) || CHAR_LENGTH(`equipe`.`id`), CONCAT_WS('', `equipe`.`nom`, ' / ', `equipe`.`id`), '') FROM `equipe` WHERE `equipe`.`actif` = 'Oui' ORDER BY 2
------------------