Hi guys,
I seem to be running into some strange behaviour.
I have the following code
function printContracts()
{
for ( var i = 1 ; i <= currentcontroller.getMaxRecordIndex() ; i++ )
{
currentcontroller.recordIndex = i;
if ( immocontract_to_contacts_owner.contac_language == "French" || !immocontract_to_contacts_owner )
{globals.template_refnr = 2
}
else
{globals.template_refnr = 1
}
var textrepl = utils.stringReplaceTags(templates_refnr.template_text,foundset)
contracttext2 = textrepl
forms.immocontract_contract.controller.showPrintPreview()
}
}
When this is run on a single record, it give me my preview just fine and when I close the preview i get returned to the previous form.
When this is run on multiple records though, servoy gets in quite an unstable state and the client needs to be shutdown in order to be resolved.
Could someone point out what I am doing wrong?
I have read some articles on the forum which seem to indicate one should not execute code after the preview.
Does the for loop count in this case as subsequent code execution?
Many thanks for your advice.
Regards,
John