Support Questions
Find answers, ask questions, and share your expertise

Concatenations of Multiple Attributes in Nifi

Explorer

I have to create one attribute with the following details:

1. There are two attributes are flowing from EvaluateJson Proecessor :

   Location1 = $.place1 and Location2 = $.place2

2. There is one string like folder1 is to be append in these attributes as mentioned below:

Place : /folder1/Location1/Location2

 

I am trying with the below expression:

path: ${path: append("folder1/"):append(${Location1}):append('/'):append(${Location2})}

Please let me know where I am doing wrong.

 

Early reply will be highly appreciated.

 

thanks & regards

 

1 ACCEPTED SOLUTION

Accepted Solutions

Super Collaborator

Your expression looks fine.

 

I just tested as follows:

1. Generateflowfile: Add property Location1, value loc1; Add property Location2, value loc2

 

followed by:

 

2. Updateattribute processor: Add property Total, value ${path: append("folder1/"):append(${Location1}):append('/'):append(${Location2})}

 

Now the output I get is ./folder1/loc1/loc2 which is exactly what I expected.

 

If you think there may be a problem with parsing the json inthe first place, please inspect your data in the queue directly after parsing, but the concatenation seems to work. (Unless you expected a different outcome, in which case please be very clear in what you expect and see).


- Dennis Jaheruddin

If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'. Also check out my techincal portfolio at https://portfolio.jaheruddin.nl

View solution in original post

2 REPLIES 2

Super Collaborator

Your expression looks fine.

 

I just tested as follows:

1. Generateflowfile: Add property Location1, value loc1; Add property Location2, value loc2

 

followed by:

 

2. Updateattribute processor: Add property Total, value ${path: append("folder1/"):append(${Location1}):append('/'):append(${Location2})}

 

Now the output I get is ./folder1/loc1/loc2 which is exactly what I expected.

 

If you think there may be a problem with parsing the json inthe first place, please inspect your data in the queue directly after parsing, but the concatenation seems to work. (Unless you expected a different outcome, in which case please be very clear in what you expect and see).


- Dennis Jaheruddin

If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'. Also check out my techincal portfolio at https://portfolio.jaheruddin.nl

View solution in original post

Explorer

@DennisJaheruddi ,

Thanks for your reply.

 

I a able to resolve this issue with your suggestion.

 

Thanks!