pulsorock
Posts: 28
|
| Posted: 10/30/2008, 6:46 AM |
|
Hello,
I created a editable grid, that has 7 fields, 5 of these are editable, the other two are hidden fields. 1 of these hidden fields is the unique id (source_id) of the row and the other is a timestamp field (actualizado). The editable grid shows 4 rows, these rows can only be updated (no new insert or deletes). I need a way to check if for example, any editable field from an specific row was updated or changed.
For example, If any field from row 2 was changed, then the timestamp field from that row get updated too. Otherwise the field does not change.
I have tried using this OnValidateRow event, but havent managed to work. The fields are updated, but the timestamp field does not change.
global $DBwapa;
$partido = $votos_gobernacion->source_id->GetValue;
// Check current values on DB
$db_votos_aav = CCDLookUp("votos_aav", "wapa_decision2008_gobernacion", "source = '". $partido ."'", $DBwapa);
$db_votos_eim = CCDLookUp("votos_eim", "wapa_decision2008_gobernacion", "source = '". $partido ."'", $DBwapa);
$db_votos_lfb = CCDLookUp("votos_lfb", "wapa_decision2008_gobernacion", "source = '". $partido ."'", $DBwapa);
$db_votos_rfg = CCDLookUp("votos_rfg", "wapa_decision2008_gobernacion", "source = '". $partido ."'", $DBwapa);
// Compare the values with the new ones
if ($votos_gobernacion->votos_aav->GetValue != $db_votos_aav) {
$updated = true;
}
if ($votos_gobernacion->votos_eim->GetValue != $db_votos_eim) {
$updated = true;
}
if ($votos_gobernacion->votos_lfb->GetValue != $db_votos_lfb) {
$updated = true;
}
if ($votos_gobernacion->votos_rfg->GetValue != $db_votos_rfg) {
$updated = true;
}
// If any field was updated, also update the timestamp field
if ($updated == true) {
$votos_gobernacion->actualizado->SetValue(date('Y-m-d H:i:s'));
}
Any idea? I'm using CCS 3.2.0.4
Thanks
|
 |
 |
melvyn
Posts: 333
|
| Posted: 10/30/2008, 9:00 AM |
|
GetValue()
$partido = $votos_gobernacion->source_id->GetValue();
There's no parenthesis at the end, so nothing is returned for var $partido, chich is empty, by the way, all CCDlooUp are empty, all if are false and the update to $votos_gobernacion will never run.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
pulsorock
Posts: 28
|
| Posted: 10/30/2008, 12:14 PM |
|
Thanks for the comments,
I did the following changes and now works fine.... :)
global $DBwapa;
$partido = $votos_gobernacion->source_id->GetValue();
// Check current values on DB
$db_votos_aav = CCDLookUp("votos_aav", "wapa_decision2008_gobernacion", "source = '". $partido ."'", $DBwapa);
$db_votos_eim = CCDLookUp("votos_eim", "wapa_decision2008_gobernacion", "source = '". $partido ."'", $DBwapa);
$db_votos_lfb = CCDLookUp("votos_lfb", "wapa_decision2008_gobernacion", "source = '". $partido ."'", $DBwapa);
$db_votos_rfg = CCDLookUp("votos_rfg", "wapa_decision2008_gobernacion", "source = '". $partido ."'", $DBwapa);
// Compare the values with the new ones
if ($votos_gobernacion->votos_aav->GetValue() != $db_votos_aav) {
$updated = true;
}
if ($votos_gobernacion->votos_eim->GetValue() != $db_votos_eim) {
$updated = true;
}
if ($votos_gobernacion->votos_lfb->GetValue() != $db_votos_lfb) {
$updated = true;
}
if ($votos_gobernacion->votos_rfg->GetValue() != $db_votos_rfg) {
$updated = true;
}
// If any field was updated, also update the timestamp field
if ($updated == true) {
$DBwapa->query("UPDATE wapa_decision2008_gobernacion SET actualizado='".date('Y-m-d H:i:s')."' WHERE source='".$partido."'");
}
|
 |
 |
|