thierrybo
Posts: 8
|
| Posted: 02/01/2005, 2:04 PM |
|
Hi,
I have a "before show" event in my datagrid within one column. I want to change the displayed value depending on the value of another field. This is normally easy using $gridObject->fieldName->GetValue()
However, I try to read value from a field that is NOT in the grid (I mean, not displayed), but this field IS selected in the datasource (in SELECT statement).
Is this the reason why I get Fatal error: Call to a member function on a non-object in ?
I don't want to make another query just to do that, so is there a mean to read field value from fields in SELECT statement but not displayed in grid ?
Thierry B.
|
 |
 |
aakici
Posts: 49
|
| Posted: 02/01/2005, 4:25 PM |
|
if you want to use GetValue then you must add a hidden textbox to your form.
however, you can get the value from your sql by assigning the sql result to a variable. For example;
$SQL = "SELECT SUM(ordertotal) As total FROM orders WHERE order_customer_id=" . CCToSQL($kosul,ccsInteger);
$db->query($SQL);
$Result = $db->next_record();
$result = doubleval($Result);
if ($Result) {
$deger =$db->f("total"); //Here is a variable assigned by an Sql result
}
_________________
Regards,
M.Alpaslan AKICI |
 |
 |
Nicole
Posts: 586
|
| Posted: 02/02/2005, 2:54 AM |
|
Hello,
You can also retrieve a value directly from a recordset, e.g.:
global $gridObject;
$gridObject->control_name->SetValue($gridObject->ds->f("field_name"));
_________________
Regards,
Nicole |
 |
 |
thierrybo
Posts: 8
|
| Posted: 02/02/2005, 3:51 AM |
|
Thanks to aakici and Nicole. I will try both hidden textbox and retrieving value directly from the recordet, although I believe the second solution is more 'clean'.
Thierry B.
|
 |
 |
aakici
Posts: 49
|
| Posted: 02/02/2005, 11:19 AM |
|
I think so.
_________________
Regards,
M.Alpaslan AKICI |
 |
 |
|