Support Questions

Find answers, ask questions, and share your expertise

Make a copy of columns and reanme it in NiFi processor

avatar
Expert Contributor

Hello Team,

 

I have one column and did some calculation on it and wanted to make another copy of same column to create flag to check whether records are empty or not and retain the same column also.I tired to using pulling another processor and  wrote calculation New_field , Old_column which did not work.

However, this approach did not yield the desired outcome.

saquibsk_0-1709381366837.png

 

saquibsk_2-1709381609308.png

saquibsk_1-1709381579480.png

 

 

Shakib M.
1 ACCEPTED SOLUTION

avatar
Super Guru

@saquibsk,

It seems you are using Literal Value  in the Replacement Value Strategy of the second UpdateRecord. I think it needs to be "Record Path Value" since you are referencing another field from the content data itself.

 

If that helps please accept solution.

Thanks

View solution in original post

3 REPLIES 3

avatar
Super Guru

@saquibsk,

It seems you are using Literal Value  in the Replacement Value Strategy of the second UpdateRecord. I think it needs to be "Record Path Value" since you are referencing another field from the content data itself.

 

If that helps please accept solution.

Thanks

avatar
Expert Contributor

Thank you very much @SAMSAL . Do we need to provide the  JsonPath expressions ? I had simplifed data using JOLT Spec so I am getting flat JSON so below has worked.  What about if we have structured data ? 

Another Question: what if I wanted to write the calculation on column rather than filed.value ? something like below ?

saquibsk_1-1709390545624.png

 

 

Shakib M.

avatar
Super Guru

Hi @saquibsk ,

The UpdateRecord processor uses the Nifi Record Path syntax to traverse record structure :

https://nifi.apache.org/docs/nifi-docs/html/record-path-guide.html

When your Replacement Value Strategy is set to Record Path Value then the path has to adhere to the record path syntax as explained in the link.  The record path allows you to update structured data even if you have more than one record in an array of records. Please see the documentation here as well for more help:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.7.1/org.apache...

If you are having more issues it would help to provide sample input and the expected output result alongside the relevant processors configuration screenshot. This will enable the community to help you better and resolve your issue faster.

If you find this is helpful please accept  solution.

Thanks