form.newrecord() question

I have a few questions about the execution order for newrecord()
when I call it, then follow it with filling dataproviders eg.

forms.people.controller.newRecord()
forms.people.address = globals.g_address
forms.people.email = globals.g_email
forms.people.first_name = globals.g_first
forms.people.last_name = globals.g_last
forms.people.opt_name = globals.g_opt
forms.people.phone = globals.g_phone
forms.people.title1 = globals.g_title1
forms.people.title2 = globals.g_title2
forms.people.controller.saveData()

When does the sql insert query get executed? I have fields that don’t allow for null values and I am getting messages saying that I am inserting a null value. This leads me to believe that a blank new record is created rather than a insert with values(1,2,3,4,5) statement.

can I do something analogous to newrecord(1,2,3,4,5)?

Additionally,

I am dealing with a DB defined auto_incrementing field. I need to:

  1. create a record for a person
  2. then create a 1-N related record in a mapping table of person_id to group_id

group_id is related to a 3rd static table, containing Group_name

How can I create these 2 records with matching person_id fields? new related record?

the insert in youre case is only being done at the call saveData()
so there has to be one column that you don’t set that’s still empty

yes calling newRecord() on the relation will filll in the right id’s for you

If you are using DB defined keys then the best thing is that you DO save the parent record before creating related records. Servoy will try to update the keys aftewards but the best way is to save the parent record