Shrads
Shrads

Reputation: 883

Extract values from CSV and place it in a new column within the same CSV file using NiFi

I have a CSV file from which i need to extract two values like 'UutId & Test' and place it in the last column (filename).How can i pull/extract values from same CSV file and place it in the last column of the same CSV file called 'filename' which is blank(without any values right now). If possible please tell what processor and configs to use?TIA

For reference i am attaching CSV file snapshot of value i want to add in the last column called 'filename' repeated in the whole CSV records.

Values to be extracted Values to be extracted

The column in which the values should be placed The column in which the values should be placed

List queue after GetFile List queue

The list queue after playing the UpdateRecord processor makes it blank file.

List queue after playing UpdateRecord List queue after playing UpdateRecord please help

Upvotes: 0

Views: 1346

Answers (1)

notNull
notNull

Reputation: 31550

Use UpdateRecord processor below configs

in CSVRecordSetWriter controller service add filename column with string type as last field in the avro schema.

UpdateRecord Configs:

enter image description here

Add new property in UpdateRecord processor as

/filename

concat(/UutId,/Test)

As we are using Record Path Value as Replacement Value Strategy

now update record processor will concat UutId,Test values to filename column value.

Refer to this link for more details regarding Update Record processor.

Upvotes: 2

Related Questions