Elisha Klein
|
| Posted: 01/02/2006, 9:38 PM |
|
Hi,
I am evalauting codecharge studio.
If I have a row in a editble grid from multiple tables will it update both of the tables or only the correct one if some of the data is changed ?
Is there a way to bring in data from one table but perform the update or insert to another table without updating the original ?
Specifically I have a table of comments I want to bring in all the rows from that table add a radio button so the user can rank each comment and then insert the rankings into the commentrankings table.
I tried to add a custom insert but the problem is that codecharge thinks its an update because the original rows came from the comments table.
Thanks for any help,
Elisha.
|
|
|
 |
TheunisP
Posts: 342
|
| Posted: 01/03/2006, 4:05 AM |
|
Isn't this a multiple realtionship question - e.g. many-2-many? That means that you only need to update the link table between the 2 tables if I have it correctly?
|
 |
 |
Elisha Klein
|
| Posted: 01/03/2006, 5:12 AM |
|
I don't want to display only the ralationship table in the grid beacuse I want to display also (and perhaps mostly) the comments that the user hasn't rated yet.
So the problem is I want the grid to select from table a (comments) and insert into table b (commentratings).
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 01/03/2006, 6:17 PM |
|
I think that if I needed to implement this then I would probably have to experiment with various possible solutions to "figure this out". This type of problem may not be CCS specific, because this could be tricky with any development tools, eother for Windows or Web development. Thus I'm not sure if you will be able to do this quickly if you just started using CCS.
If you already started doing some custom coding via events and understand them, then maybe you could try using the editable grid to display the existing records, then when the grid is submitted switch the UDPATE statement into an INSERT statement to insert records into another table. Unfortunately I cannot offer a specific and tested solution without actually working on your project. Possibly someone else may have done this and could offer a ready solution, another approach, etc.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Elisha Klein
|
| Posted: 01/03/2006, 9:57 PM |
|
Thank you for your reply.
Where would be the correct event to switch the update statement into an insert statement ?
Elisha.
|
|
|
 |
magus
Posts: 98
|
| Posted: 01/05/2006, 3:02 PM |
|
Dear Elisha and Peter,
I have done this with editable grids.
Bascially, my method is to set up the editable grid to work with only the table that will be updated. Then in the BeforeExecuteSelect Event change the sql statement to a join query that queries multiple tables.
This way all the Editable Grid functions will continue to work on the primary table while the data from secondary tables is available for display.
For controls used to display field values from secondary tables set "Control Source Type" = "Database Column". Then just type the field name (as returned by your query) into the "Control Source" option because it won't be available in the drop down field list. It is however available.
I hope this helps.
Regards,
Don A
PS. To change the SQL statement
$(InsertComponentName)->ds->SQL= "<Write SQL>";
If you want to retain an accurate count of the result set then you should also update:
$(InsertComponentName)->ds->CountSQL
|
 |
 |
Elisha Klein
|
| Posted: 01/05/2006, 10:57 PM |
|
Thanks a lot Magnus.
Good stuff !
|
|
|
 |