
rado
Posts: 221
|
| Posted: 11/07/2008, 8:15 AM |
|
I made the grid with record where I use just one table. One of the field in the grid is the "depart_id". What I want to do is display the name (value) of "depart_id" from second table (department). I tried to add additional table (department) in data source of grid, however my initial sql query changed. Is there any way to add separate sql query that will retrieve the value just for specific field in the grid.
Thanks a lot for help
|
 |
 |
melvyn
Posts: 333
|
| Posted: 11/07/2008, 8:34 AM |
|
Inside the visual query builder you can point the another table to display a second field in the grid.
The hard-coded version is a before show row event using CCDLookUp()
Try to get the first want with the assistant, I recommend.
The second work as follow:
1) place cursor in the row and insert an empty label (which will receive the department name) and let's rename it to department.
2) Go to properties -> events and add custom event to "Before Show Row"
3) In the above event custom code place this (modify with your values):
global $dbconnection; // change to set your connection name
$depart_id = $Component->depart_id->GetValue();
$department = CCDLookUp("department_name","department_table","id=".$depart_id,$dbconnection);
$Component->departament->SetValue($department);
This must work if you change the variable names to match yours.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
rado
Posts: 221
|
| Posted: 11/07/2008, 8:40 AM |
|
Thank you soooooo much. I was thinking about similar, however I was not sure is it correct way.
Let me try.
Rado
|
 |
 |
rado
Posts: 221
|
| Posted: 11/07/2008, 9:35 AM |
|
Thanks Melvyn, you helped me again.
Somehow I use query builder again and this time worked just fine.
Rado
|
 |
 |
|

|
|
|
|