NetTalk Central

Author Topic: NetWebServiceMethod - how to update parent AND children record in one call  (Read 3890 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Hi,

This might not be the standard way to do it, but in some cases I want to add child table updates to the parent update method. For example when a Person record is updated, I also want to update Next of Kin records against the person.

How should one do this, or are there examples available to do it?

Thanks
Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Hi Thys,

Not sure if there are examples, given that you can pretty much do whatever you like <g>.

But let's say you had a form on the Parent table, and clicked on Save, then it'll do a Validate Record, and write the Parent away. You then have routines (PostInsert, PostUdate and so on) that you can embed code into.

The form fields are still in scope here (as session values). You would need to do the write yourself, but everything you need could be done here.

cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Hi Bruce.

Not sure whether there are PostInsert and PostUdate routines in the NetWebServiceMethod template?

The question that I have is how to structure the input and output parameters to the method. Having parent/child structures in a queue or group is difficult to represent the table hierarchy exactly - especially when there can be any number of child records per parent record, which essentially requires a queue within a queue.

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
sorry, I missed the Method bit in the title. I replied as if for a form.

The incoming (table) parameters flow through the
AutoService:TableLable routine

there are embeds there you can use.

From there it flows to the other routines;
InsertRecord:TableLable
UpdateRecord:TableLable
DeleteRecord:TableLable

And you can embed in those if you like.

Cheers
Bruce