foreign keys in Details Mode

Talk about foreign keys

Moderators: ne_moj, zewa, vadimako, ne_moj, zewa, vadimako

notebookoutlet
Senior
Senior
Posts: 34
Joined: Mar 12th, '10, 02:17

foreign keys in Details Mode

Postby notebookoutlet » Jun 17th, '10, 11:02

I don't need Add/Edit mode. In Details mode, I want to show both Customer's First Name, Last Name and even phone number in the foreign keys field of CustomerID. But Concat is not working with quote. How can I make it work? Thanks.

DB Error: no such field SELECT `CustID`,`Concat(CustFirst, CustLast)` FROM `customer` WHERE 1=1 AND `CustID` = '6392' ORDER BY `CustFirst` ASC [nativecode=1054 ** Unknown column 'Concat(CustFirst, CustLast)' in 'field list']

$foreign_keys = array(
"CustID"=>array("table"=>"customer", "field_key"=>"CustID",
"field_name"=>"Concat(CustFirst,CustLast)",
"view_type"=>"textbox", "radiobuttons_alignment"=>"horizontal|vertical", "condition"=>"", "order_by_field"=>"CustFirst", "order_type"=>"ASC", "on_js_event"=>"")
);

administrator
Site Admin
Site Admin
Posts: 5988
Joined: Jan 7th, '09, 23:18
Contact:

Re: foreign keys in Details Mode

Postby administrator » Jun 20th, '10, 09:24

Use: Concat(CustFirst,CustLast) as my_field

notebookoutlet
Senior
Senior
Posts: 34
Joined: Mar 12th, '10, 02:17

Re: foreign keys in Details Mode

Postby notebookoutlet » Jun 20th, '10, 14:18

I change to use Concat(CustFirst,CustLast) as my_field in foreign_keys field but still not working.

$foreign_keys = array(
"CustID"=>array("table"=>"customer", "field_key"=>"CustID",
"field_name"=>"Concat(CustFirst,CustLast) as Cust",
"view_type"=>"textbox", "radiobuttons_alignment"=>"horizontal|vertical", "condition"=>"", "order_by_field"=>"CustFirst", "order_type"=>"ASC", "on_js_event"=>"")
);

It still complain about Unknown Column. If I can remove the single quote automatically attached by $foreign_keys's field_name, then it will work with concat. But where can I remove those single quote? Thanks.

Errors:
1) SELECT `CustID`,`Concat(CustFirst,CustLast) as Cust` FROM `customer` WHERE 1=1 AND `CustID` = '9445' ORDER BY `CustFirst` ASC
[nativecode=1054 ** Unknown column 'Concat(CustFirst,CustLast) as Cust' in 'field list']

administrator
Site Admin
Site Admin
Posts: 5988
Joined: Jan 7th, '09, 23:18
Contact:

Re: foreign keys in Details Mode

Postby administrator » Jun 20th, '10, 21:50

The problem is in using of ` - remove it or download the latest version of DataGrid


Return to “Field type: "foreign key"”