jdojr
Posts: 6
|
| Posted: 01/27/2008, 9:52 AM |
|
Hey All...
I have an editable grid which is populated by a query, and then updates should be sent to a table. Updates work, but some of the rows from the query don't "exist" so changes to these don't get updated (as inserted rows to the table) since the grid doesn't think they are new. Kind of like this -
http://forums.yessoftware.com/posts.php?post_id=84792
As per Peterr's suggestions there, I can trick it with custom update, but problem is, that since some of the queried records will exist and others not, I think I need to go with his other suggestion about "dynamically modifying the UPDATE statement at run time."
Assuming I can use an IF statement or something to conditionally replace UPDATE with INSERT on a per row basis (using a field value to flag whether or not the row already exists), I think this would work.
MY PROBLEM, is that I am relatively new to CCS and PHP, and so am not having much luck adding the right code to the BEFORE EXECUTE UPDATE even for the grid.
Whatever SQL UPDATE statement I end up with, will need to refer to fields on the grid, of course.
Could someone give me a little nudge as to the structure of what needs to go ** HERE ** in the code sample ?
Or maybe I am completely on the wrong track.
Thanks
Dave
==================================================
<?php
//BindEvents Method @1-4B0E295B
function BindEvents()
{
global $prog_grp_sessions;
$prog_grp_sessions->ds->CCSEvents["BeforeExecuteUpdate"] = "prog_grp_sessions_ds_BeforeExecuteUpdate";
}
//End BindEvents Method
//prog_grp_sessions_ds_BeforeExecuteUpdate @5-6B97373A
function prog_grp_sessions_ds_BeforeExecuteUpdate(& $sender)
{
$prog_grp_sessions_ds_BeforeExecuteUpdate = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $prog_grp_sessions; //Compatibility
//End prog_grp_sessions_ds_BeforeExecuteUpdate
//Custom Code @56-2A29BDB7
// -------------------------
** HERE ** !!
// -------------------------
//End Custom Code
//Close prog_grp_sessions_ds_BeforeExecuteUpdate @5-8F2AF7D4
return $prog_grp_sessions_ds_BeforeExecuteUpdate;
}
//End Close prog_grp_sessions_ds_BeforeExecuteUpdate
?>
==================================================
_________________
J Osterman |
 |
 |
jdojr
Posts: 6
|
| Posted: 01/27/2008, 6:38 PM |
|
I think there might be a clue here -
http://docs.codecharge.com/studio32/html/index.html?htt...ration.html?toc
_________________
J Osterman |
 |
 |
jdojr
Posts: 6
|
| Posted: 01/28/2008, 8:03 PM |
|
I hope my question doesn't include too much unnecessary detail.
I guess I just need a little push in the right direction. I've looked line by line through at least a year of posts, and read everything I can find in the manual, and just can't seem to get very far.
Thanks !
_________________
J Osterman |
 |
 |
datadoit
|
| Posted: 01/29/2008, 5:54 AM |
|
Look here also for information on accessing an editable grid's row values:
http://forums.yessoftware.com/posts.php?post_id=60507
|
|
|
 |
jdojr
Posts: 6
|
| Posted: 02/02/2008, 5:27 PM |
|
Thx datadoit. I don't think I ended needing that type of access, but I probably will at some point.
In the meantime I came up with a solution that seems to work, at least in the test environment. I added it here, if anyone is ever wondering in the future -
http://forums.yessoftware.com/posts.php?post_id=93398
_________________
J Osterman |
 |
 |
|