Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Runing custom query (custom tables) while insert data View modes: 
User avatar
Member
Member
Greg - 11/22/2012 10:04:00 AM
   
Runing custom query (custom tables) while insert data
Hello,

I modified 'insert' query for one of my custom tables (Queries->Insert). I would like it to be executed while end-users adds new data to table using "Data" tab. It is because I must create a relation in other table for this record. The query contains basically another INSERT... .

Could you advice how to do this please?

Gregory

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 11/27/2012 1:15:38 AM
   
RE:Runing custom query (custom tables) while insert data
Hi,

Modifying the insert query should allow you to change the way how and what is stored, however, it's not possible to run two insert queries as one. One of the typical problems would be how to obtain the correct ID for the relation - to be referenced in other table.

I think that better approach to achieve your aim would be to use a custom global event handler, which would store the relation record after an Insert (or Update) event happens (= OnAfter-..) for the custom table.
Please see more details how to achieve it at devnet.kentico.com/docs/6_0/devguide/event_handlers_overview.htm

Regards,
Zdenek