Creating (related) records

I have the following method:

	for ( var i = 1 ; i <= controller.getMaxRecordIndex() ; i++ )
	{
		controller.recordIndex = i;;
		relaties_to_mailingen_lineitems.newRecord()
		relaties_to_mailingen_lineitems.mailingenid = globals.mailingid
	
	}
	plugins.dialogs.showInfoDialog('Info', 'Ready!','OK');

Basicly I’m looping thru 230 records. For every record there is new record made in the table: mailingen_lineitems.
This takes about 1 second per record. So this method takes 230 seconds! :shock:
Is there a way to do this quicker??

Can you send me your solution?
This should go faster.

I skipped this line in your script: relaties_to_mailingen_lineitems.mailingenid = globals.mailingid

Since you called the relation in the NewRecord command the id-number
will be put automaticly.
But this does’nt speed up the loop. :(
Hope Maarten will find a solution for this..

No that is not neccesary.
We discussed this somewhere else on this forum .

the method must be:

   for ( var i = 1 ; i <= controller.getMaxRecordIndex() ; i++ ) 
   { 
      controller.recordIndex = i;; 
      forms.mailingen_lineitems.newRecord() 
      forms.mailingen_lineitems.mailingenid = globals.mailingid 
    
   } 
   plugins.dialogs.showInfoDialog('Info', 'Ready!','OK');

so make the records right on the form itself and not thru a relation. This method is going very fast!!