Autofilter problem with custom query

QuestionsAutofilter problem with custom query
JOEL GOMES asked 4 years ago

Hi all
Im having a problem, i have a grid with this query:
$g->select_command = "select * from (SELECT groupid,client, vat,vatcountry,adrcity, SUM(balance)
FROM (
SELECT groupid,client,vat,vatcountry,adrcity, balance FROM CLIENTS_CLIENTS where credit='Yes'
UNION SELECT groupid,client,vat,vatcountry,adrcity,value FROM MONEY_IN
) t
GROUP BY t.client) as o";

My problem is i cant autofilter or search allways receive an error, how can i solve this?

Thank you again
Really good work on this grid

6 Answers
Abu Ghufran answered 4 years ago

Please email me database sql and testing data for generating case.
You can email at [email protected]

Glenn answered 4 years ago

Hi Abu,
I am experiencing a similar problem

Everything works great until I try to use the filter.
Here is a link to an example.
http://websalesdesign.com/proj/lib/phpgrid-full/index.php

I paired down the calc-column example so there are only 3 fields with the below query.
I used dbname for all fields.
$col["dbname"] = "c.name";

$g->select_command = "SELECT c.name, c.client_id, ii.invcount FROM clients c left outer join (select client_id cid, count(*) invcount from invheader group by cid) ii ON ii.cid = c.client_id";

It gives the following error.
Couldn't execute query. Unknown column 'c.name' in 'where clause' – SELECT count(*) as c FROM (SELECT c.name, c.client_id, ii.invcount FROM clients c left outer join (select client_id cid, count(*) invcount from invheader WHERE 1=1 AND ( `c`.`name` LIKE '%z%' ) group by cid) ii ON ii.cid = c.client_id) pg_tmp

Regards,
Glenn

Abu Ghufran answered 4 years ago

Emailed update lib that should resolve this issue.

Javier answered 4 years ago

Hello. I have a similar problem. Concat use to join two fields in a query. This column is called "description". This field is used in the grid, but when writing a filter expression I get the error: Could not execute query. Unknown column 'description' in 'where clause'. Would have to update the lib too? Please could you send it to me? Thank you!!

Abu Ghufran answered 4 years ago

Emailed you latest build.

bazel answered 4 years ago

I'm having the same issue with UNION ALL. Please can you send me the lib?
Thanks

Your Answer

17 + 2 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!