connector beforeFilter

Hello!



I’m using the event “beforeFilter” to change the name of ‘$filter_by->rules[$irules][“name”]’ in live.

this is because some database fields need table name: (ex: field: ‘StudyDescription’ -> ‘study.StudyDescription’)



i wrote my function like this:



function doBeforeFilter($filter_by){

$irules = 0;

for (;$irules < sizeof($filter_by->rules);$irules++){    

if($filter_by->rules[$irules][“name”] == “StudyDescription”) {

$filter_by->rules[$irules][“name”] = “study.StudyDescription”;

}

}

}



But in your log (some.txt), ‘$filter_by->rules[$irules][“name”] =’ stay ‘StudyDescription’ and the sql response is



"

Message: MySQL operation failed

Column: ‘StudyDescription’ in where clause is ambiguous

"



Tell me what you think about and how to change $filter_by->rules[$irules][“name”]?



best regards,

a) you can change the name in field list as

$some->render_sql("…","…",“somfield,study.StudyDescription(StudyDescription),someother”)

in such case connector will use StudyDescription for field naming, but will use study.StudyDescription in generated sql

b) you can try to update connector with next fix, which must resolve problem with your original solution.
support.dhtmlx.com/x-files/docum … 96_fix.zip

Hello Stanislav,

I try your connector_96_fix.zip but its not working properly.
1: I get always only 40 rows (I have 75 rows in my database).

2: I get some error in some.txt:
"
Undefined property: GridDataItem::$userdata at C:\xampp\htdocs\dhtmlxSuite\dhtmlxConnector_php\codebase\grid_connector.php line 112
Invalid argument supplied for foreach() at C:\xampp\htdocs\dhtmlxSuite\dhtmlxConnector_php\codebase\grid_connector.php line 112
"

3: i have a sql error because y add some " ’ " in the ORDER BY:
"
SELECT  study.ID as SID (…) FROM patient INNER JOIN study ON (study.IDPatient = patient.ID)
INNER JOIN series ON (series.IDStudy = study.ID)
INNER JOIN image ON (image.IDSeries = series.ID) GROUP BY study.ID ORDER BY ‘study.StudyDate’ DESC LIMIT 0,40
"
I found you added “$this->escape_name” in
file: db_common.php
class: DBDataWrapper
fonction: build_order

What do you think about?

regards,

I foregot your point ‘a’.
It’s working fine.
thanks a lot.