Overview
Almost all data exchange formats in Etlworks (such as CSV, JSON, etc.) can be configured with a script to capture or modify the source or destination filename.
This function is executed only when the format (source or destination) is used in the source-to-destination ETL transformation.
Only JavaScript is supported for this function.
Variables
The following variables are available:
fileName
: the filename calculated by the connector.isReading:
true
if the function is executed for the source (in the source-to-destination transformation).batchNumber
: integer, the batch number when the connector splits the file, otherwise -1
Modify filename
To modify the filename the function must return a string which is a new filename. Example:
value = com.toolsverse.util.FilenameUtils.getBaseName(fileName) + '_test' + '.csv';
Capture filename
You can store the filename in the global or flow variables or as a key/value in flow storage. Example for global variable:
com.toolsverse.config.SystemConfig.instance().getProperties().put('file_to_read', fileName);
Comments
0 comments
Please sign in to leave a comment.