Overview
When working with databases where the database is a destination, it is possible to execute automatically prepared SQL statements conditionally. For example: UPDATE
records if a certain flag is set, otherwise, MERGE
.
Configure conditional SQL action
For databases, this feature is available under MAPPING
/ Parameters
/ Action Conditions
.
Field values can be referenced from JavaScript code by using dataSet.getFieldValue(currentRow,
'field name')
or the {field name}
.
Possible actions are: INSERT
, UPDATE
, DELETE
, MERGE
, nothing
.
If action is set to nothing
If the Conditional
action is set to nothing
the system will simply skip the record.
Available objects
The following objects can be referenced by name from the JavaScript code:
Object name | Class name / JavaDoc | Package |
---|---|---|
dataSet | com.toolsverse.etl.common.DataSet | com.toolsverse.etl.common |
currentRow | com.toolsverse.etl.common.DataSetRecord | com.toolsverse.etl.common |
etlConfig | com.toolsverse.etl.core.config.EtlConfig | com.toolsverse.etl.core.config |
scenario | com.toolsverse.etl.core.engine.Scenario | com.toolsverse.etl.core.engine |
destination | com.toolsverse.etl.core.engine.Destination | com.toolsverse.etl.core.engine |
Example
{Types}.equals('U') ? 'update' : 'insert';
Comments
0 comments
Please sign in to leave a comment.