pathans
Posts: 46
|
Posted: 11/08/2012, 4:29 PM |
|
I have a grid(results) which is showing following information.
db_fieldname| old value | new value.
============================
asset_name| pc123 | pc456
asset_env | 2| 3
I want to replace 2 and 3 for asset_env from assets_envir table (assets_env_name)
Don't know how to do whole sql. can someone please help.
if i am not wrong it would be something like this in before show.
if ($Results->db_field->getvalue () = ' assets_env'{
$results->oldvalue->setvalue = ( sql statment);
}
so grid would show something like this
db_fieldname| old value | new value.
============================
asset_name| pc123 | pc456
asset_env | prod | stage
|
|
|
Lucius
Posts: 220
|
Posted: 11/09/2012, 6:23 AM |
|
Use Before Show Row Event and CCDLookUp (check this function in CCS help), it would look like something in lines of:
$db = new clsDB_YOUR_DB_NAME_;
if ($Results->db_field->getvalue () = ' assets_env' {
$results->oldvalue->setvalue( CCDLookUp("assets_env_name", "assets_envir", " assets_env = '".$results->oldvalue->getvalue()."'", $db));
}
|
|
|
pathans
Posts: 46
|
Posted: 11/09/2012, 1:40 PM |
|
Thank you it worked.
I was doing it under beforeshow for the form i guess that doesn't work plus there was a typo i think in my code
thanks again
|
|
|
Lucius
Posts: 220
|
Posted: 11/10/2012, 1:24 AM |
|
Before show event applies to the grid as a whole, not a specific row. So you can change anything that is not inside actual grid row.
|
|
|
|