Transformations > Java transformation API reference > generateRow


Generates an output row for active Java transformations.
When you call generateRow, the Java transformation generates an output row using the current value of the output field variables. If you want to generate multiple rows corresponding to an input row, you can call generateRow more than once for each input row. If you do not use generateRow in an active Java transformation, the transformation does not generate output rows.
Use generateRow in any section of the Java editor except Import Packages. You can use generateRow with active transformations only. If you use generateRow in a passive transformation, the session generates an error.
Use the following syntax:
Use the following Java code to generate one output row, modify the values of the output fields, and generate another output row:
// Generate multiple rows.
if(!isNull("input1") && !isNull("input2"))
     output1 = input1 + input2;
     output2 = input1 - input2;

// Generate another row with modified values.
output1 = output1 * 2;
output2 = output2 * 2;