We have the below code which seems quite efficient as we are looping through the sections and disabling the ones we don’t want as only want the one that matches Section_Selector.
Is it possible to disable all sections by default so we can then just enable the one we want using merge.template.contexts.PRINT.sections[Section_Selector].enabled = true?
var pSections = merge.template.contexts.PRINT.sections;
for (let index = 0; index < pSections.length; ++index) {
var element = pSections[index];
if (element.name == Section_Selector)
{
Thanks I will give this a try. We are not 100% sure if the slowness we are experiencing when processing large files is down to the control script or something else in our setup but the code you have provided looks a lot tidier if nothing else and we will run some tests to see if it improves the speed.
I would not expect my suggestion to speed things up, even the old script should just take milliseconds. If we are talking about performance I think the bottleneck will be somewhere else.