I have one form in the which I have one table and others fields that come from other table, its relationship is 1-1 and I want save the fields in both tables, but I don't know how do it... how can I insert in many tables using joins? how can I insert in two tables from one form? I need your help, please!!!!!!!!!!!!!!!!!!!!!!
|
|||

Sorry for my friend (and for
Sorry for my friend (and for my english too) he's desesperate, he had 2 months trying it.
I have the same problem maybe in the next release it would be fixed. Come on Luis let's go to pistear (alaska) ok see you and thanks for this wonderfull framework. Regards
I'm not sure what Mane is
I'm not sure what Mane is referring to in his spanish post, but I can offer up a more detailed suggestion.
Check out this page for instructions to overwrite OpenBiz's default behavior when saving data.
http://www.phpopenbiz.org/jim/node/206/
Jim
Jim's guide for "Custom
Jim's guide for "Custom Classess: BizDataObj" is greatly written. It is a good starting point to explore the power of openbiz.
The plan for supporting "1 Save call to update 2 tables" in 2.2.3 is to have a new attribute in join. The attribute will have a name like "OnSaveDataObj". If this attribute is not empty and points to the dataobj whose main table is the joined table, openbiz core will call update/insert on OnSaveDataObj.
If you have suggestion on this solution, feel free to add your comments.
This feature will greatly
This feature will greatly extend already good OpenBiz User Interface. It makes sense to combine two or more forms and seamlessly present them as one form. I like Rocky's design offering, but would it make more sense putting reference of the updatable object within <ObjReferences> section? Let's say add Updatable="Y" attribute?
But here is a caveat. Besides specifying what object will be used to update joined record we need to specify what fields are updatable via, for example, ForeighFieldUpdate="Y" attribute. The reason is that not all joined fields MUST be updatable. Opinions / comments / movie reviews are welcomed.
Thanks,
Andrew
Here is another very easy
Here is another very easy solution for now: use dataobject triggers. For TriggerType="Update" and "INSERT" specify all update and insert statements and you'll be good to go.
What would be possible to do in the future is to extend existing <TriggerAction Action="ExecuteSQL|ExecuteShell|SendEmail"> with one more action that would process dataobject. <ActionArgument> will list all joined dataobject fields that need to be updated or inserted.
From development point of view previously mentioned solutions with extending dataobject metadata will be more straighforward, but from flexibility and control perspective dataobject triggers are the best.
Thanks,
Andrew
I like me your idea... and I
I like me your idea... and I had thought the same, but I can't does it.. Can you help me with some example?
mane, The following trigger
mane,
The following trigger is responsible for executing couple of DMLs on dataobject UPDATE. It should give you a good idea what/how to do it in your situation. Let us know if it's helpful or not.
<PluginService Name="_ua_episode_Trigger" Description="" Package="main.DO" Class="service.doTriggerService" DataObjectName="_ua_episode">
<DOTrigger TriggerType="UPDATE">
<TriggerCondition Expression="{[episode_status]=='Discharged'||[episode_status]=='Closed'}" ExtraSearchRule="" />
<TriggerActions>
<TriggerAction Name="RunSQL1" Action="ExecuteSQL" Immediate="Y" DelayMinutes="" RepeatMinutes="" Description="">
<ActionArgument Name="DBName" Value="UniqueAid" />
<ActionArgument Name="SQL" Value="delete from calevts_attds where evt_id in (select sysid from calevts where Episode_ID ='{@:Field[Id].Value}' and Account_ID='{@:Field[AcctID].Value}' and starttime > DATE_ADD('{@:Field[discharge_date].Value}',INTERVAL 1 DAY))" />
</TriggerAction>
<TriggerAction Name="RunSQL2" Action="ExecuteSQL" Immediate="Y" DelayMinutes="" RepeatMinutes="" Description="">
<ActionArgument Name="DBName" Value="UniqueAid" />
<ActionArgument Name="SQL" Value="delete from calevts where Episode_ID ='{[Id]}' and Account_ID='{[AcctID]}' and starttime >DATE_ADD('{@:Field[discharge_date].Value}',INTERVAL 1 DAY)" />
</TriggerAction>
<TriggerAction Name="RunSQL3" Action="ExecuteSQL" Immediate="Y" DelayMinutes="" RepeatMinutes="" Description="">
<ActionArgument Name="DBName" Value="UniqueAid" />
<ActionArgument Name="SQL" Value="update ua_account set `Status`='inactive' where `ROWID`='{[AcctID]}' and not exists (select 1 from ua_episode where episode_status='active' and PatientAcct_ID='{[AcctID]}')" />
</TriggerAction>
</TriggerActions>
</DOTrigger>
</PluginService>
UpdateForm modification
Dear mane,
From what I have done, I subclassed BizForm class and modified the UpdateForm function to write into several tables using the data from the corresponding form.
Regards,
Agung
Ya lo intente asi y no
Ya lo intente asi y no funciona
lo que quiero hacer es insertar en 2 o mas tablas obteniendo los datos de una forma y creo que modificando el UpdateForm no es la solucion