A DataRow packet is sent by the server to the client for each row in a result set. It contains the values for each column of the row, which can be accessed by name (case-sensitive) or by column number (0-based):
if (context.packet.customer_name === 'Jones') ...
if (context.packet["customer_name"] === "Jones") ...
if (context.packet[3] === "Jones") ...
rowDescription: the RowDescription packet sent by the server at the beginning of the result set.
packetType: always "DataRow"
SimpleDateFormat getDateFormat(string format): returns a SimpleDateFormat object using the provided format string. This object can be used to parse and format dates and times.
InputStream getJavaStream(String column): returns the value of the specified column as a Java InputStream. The specified column must be binary (i.e. one of the blob types or varbinary). If the value is null, null is returned. See the bitmap watermark example for a typical application.
void remove(): marks this row as "removed" -- it will not be forwarded to the database client.
object getColumnValueObject(string name): retrieve the value of the specified column. The only time you normally need to use this method is if you happen to have a column whose name conflicts with one of the attribute or method names.
Changing a value in a row:
if (context.packet.country === 'DK') {
context.packet.salary = 0;
}
Changing a value based on metadata in a result set filter:
if (context.packet.rowDescription.getFieldByName("salary") != null) {
context.packet.salary = 0.0;
}
Hiding rows that have certain criteria:
if (context.packet.userName === 'aenewman' && context.packet.state !== 'MN') {
context.packet.remove();
}