2

This question is related to this SO question

Above solution solved my problem, Now I tried to connect this into a flow coming from QueryRecord processor.

Here this QueryRecord divide my flowfile into two streams. Lets say customers and suppliers. And ExecuteGroovyScript is used to add ORDER and COMPLAINT.

Sample csv :

id,record_type
1,0
2,0
3,1

So result should be :

id,record_type
1,ORDER
2,ORDER
3,COMPLAINT

Actual result just placed default 'IGNORE' value.

QueryRecord configurations QueryRecord Configuration

QueryRecord csv write schema. CSV writter

1 Answer 1

3

If you just want to update the field value simply, then use UpdateRecord processor.

When you input the text as follows:

id,record_type
1,0
2,0
3,1

then setting the record reader to CSVReader with the option Schema Access Strategy to the Use String Fields From Header. The writer is not a concern. The UpdateRecord processor properties look like this:

Record Reader               CSVReader
Record Writer               CSVRecordSetWriter
Replacement Value Strategy  Literal Value
/record_type                ${field.value:replace('0','ORDER'):replace('1','COMPLAINT')}

This will give your expected result.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.