- Code: Select all
function clearEmptyItems(recInvoice)
{
var numItems = 0;
var recItems = [];
if (utils.hasRecords(recInvoice.invoices_to_invoice_items))
{
numItems = recInvoice.invoices_to_invoice_items.getSize();
}
// As we will be deleting the records from the foundset, gather each of them so we don't rely on the (dynamic) index position
for (var index = 1; index <= numItems; index++)
{
var recItem = recInvoice.invoices_to_invoice_items.getRecord(index);
if (isItemEmpty(recItem))
{
recItems.push(recItem);
}
}
// Delete the item records from the foundset
recItems.forEach(function(recItemToDelete)
{
recInvoice.invoices_to_invoice_items.deleteRecord(recItemToDelete);
});
}
and
- Code: Select all
for (var index = 1; index <= recInvoice.invoices_to_invoice_items.getSize(); index++)
{
var recItem = recInvoice.invoices_to_invoice_items.getRecord(index);
if (isItemEmpty(recItem))
{
recInvoice.invoices_to_invoice_items.deleteRecord(index);
index--;
}
}