Grid Filtering "SELECT CASE"

Hello, I have problem with grid filtering when using query SELECT CASE

[code]$sql = SELECT id, name,
CASE level
WHEN 0 THEN ‘Level A’
WHEN 1 THEN ‘Level B’
WHEN 2 THEN ‘Level C’
WHEN 3 THEN ‘Level D’
ELSE ‘Level Unknown’
END as case_level
FROM tbl_master

$griddata->render_sql($sql, ‘id’, ‘name,case_level’);[/code]

myGrid.setHeader('Name,Level'); myGrid.attachHeader('#connector_text_filter,#connector_text_filter');

When grid loading for the first time data loading OK,
When type (filtering) at myGrid header col1 OK
but
When type (filtering) at myGrid header col2 got error
Unknown column ‘case_level’ in ‘where clause’

How to fix this problem.
Thanks

Hi,

Whey you are using a filtering, code will add to your SQL something like “WHERE case_level = value”, it seems it doesn’t work in your case, as you are using a complex logic in the SQL

You can define your own filtering code
docs.dhtmlx.com/connector__php__ … iltertypes

Thanks Stanislav, I will try