My Last Label never prints...

Something I’m just not seeing…

I loop through a found set and grab the correct number of labels… the but last label never prints. I watch the printer dialog box and it’s always one short of the foundset.

Has anyone else had issue with this?

globals.gWarehouseBox = the number of labels set by the user on the form.

var defaultPrinter = globals.gCurrentPrinter

if(defaultPrinter)
{
forms.Shipping_Label_Print_Screen.controller.setPreferredPrinter(defaultPrinter)

var set = forms.Shipping_Labels_Boxes.foundset;

for ( var i = 1 ; i <= set.getSize() ; i++ )
{
var record = set.getRecord(i)

record.shipping_label = full_address_calc + "Description: " + record.description + “\n” + "BOX " + record.box_number + “(” + i + " of " + set.getSize() + “)”

}

forms.Shipping_Label_Print_Screen.controller.loadRecords(forms.Shipping_Labels_Boxes.foundset);
forms.Shipping_Label_Print_Screen.controller.print(false, false);

globals.dialog_info_dynamic(‘Your ’ + globals.gWarehouseBox + ’ label(s) have been spooled\nto the printer "’ + defaultPrinter + ‘"’);
}
else
{
globals.dialog_info_dynamic(‘You must specify a printer.’);
}
} else {
controller.readOnly = true
}

Hi,

Have you stepped through this with debugger on to watch it as it processes the ‘for’ loop and see what ‘i’ is equal to when it drops out - perhaps just using a limited foundset of 3 or 4 ?

Cheers
Harry

Yes, it ‘counts’ the labels perfectly, always dropping out after the total number selected, plus one.

set.getSize() is always the correct number in the foundset so it printed on the label correctly. I just can’t get the last one to print!

I thought I could by printing to pdf, but I can see that’s not correct and I’ve tried to multiple kinds of printers, not just label printers.

Any other ideas?