File Validator
Last updated
Last updated
This component validates input data against predefined data structure.
This component validates the contents of a single file against a specified data structure. The data structure defines the expected format of the file, including the expected number of columns, their data types, delimiters, and any required or optional fields.
When the component is executed, it reads the input file and validates each row against the specified data structure. If a row does not conform to the structure, an exception can be thrown or just ignored.
This component is useful for ensuring that input files are correctly formatted and contain all the required data before further processing. It can be used in conjunction with other components, such as FileInput and FileOutput, to create a complete data processing pipeline.
This example demonstrates a data integration workflow that retrieves a file from a remote sFTP server, validates its contents against a predefined data structure, generates a result file based on the validation outcome, and returns the result file to the same remote sFTP server. If the validation is successful, a success.txt file is generated, otherwise, a fail.txt file is generated.
This screenshot shows the data structure and the input file.
This component collects files from the remote SFTP server and saves them as local files. The target files .txt files which contain header in the name. No suffix is entered. InputFile attribute is the only filter to collect the files.
The input directory has one header-body.txt file.
The target file to be validated is the first file of the collected files at FTPInput component.
If the result of the validation is success, it will proceed to Success. Otherwise, Fail component will be executed.
Success component generates simple text file named success.txt - Validation succeeded.
Fail component also generates simple text file named fail.txt. And the contents are the error message from the FileValidator component.
The FTPOutput component transfers the generated file from either Success or Fail components to the same remote sFTP server.
Attribute | Description |
---|---|
Attribute | Description |
---|---|
Data Structure Id
Data structure for the input data validation
File Name
Input file name with path
Use Carriage Return
Use carriage return(\r) and new line(\n) for windows system?
Action on Error
Action if the validation fails.
Throw Error
Response Code
If Action is Response Code, the output parameter called ValidationResult will have 9 as an error indicator. And the result of the execution of this component will be treated as success.
Validation Type?
Validate type and values?
Validate Repeat Count
Validate the repeat count?
The repeat count is mostly set in the header(master) part.
If yes, this component will validate the repeat count of the input data.
Generate Parsed Contents
Generate parsed data after validation?
ValidationResult
The result of the validation
ValidationResultMessage
The result message of the validation
ParsedContents
The parsed data