Row batch

The Row Batch pseudo-token is used to batch rows from a result set before they get presented to filters. This type is only used for result set batch filters.

It is simply a list of Row or NBCRow tokens.


Properties

  • numberOfRows (int): the number of rows in this batch

  • rows: a list of Row or NBCRow tokens

In JavaScript, a Row Batch can be iterated over, e.g.:

for (let row of context.packet) {

log.info("Row: " + row);

}


Methods

  • void addRow(object row) : adds the specified row to the end of the batch

  • void insertRow(object row, int index) : inserts the given row at the given position

  • void insertRowBefore(object row, object rowBefore) : inserts the given row before rowBefore. If rowBefore is not found in the batch, nothing happens.

  • void insertRowAfter(object row, object rowAfter) : inserts the given row after rowAfter. If rowAfter is not found in the batch, nothing happens.

  • void removeRow(object row) : removes the given row from the batch. If the row is not found in the batch, nothing happens.

  • void removeRow(int idx) : removes the row at the given index, which must be between 0 and numberOfRows.

Examples

Hide a row

for (const row of context.packet) {

if (row.customer_country === "FR" || row.customer_country === "DE") {

row.remove();

}

}

Clone and insert a row

for (const row of context.packet) {

if (row.customer_name === "Jones") {

const clone = row.clone();

clone.customer_name += " (copy)";

context.packet.insertRowAfter(clone, row);

}

}