Newbie here. I'm attempting to utilize multiple string manipulation operations for an attribute that has been passed into one of my processors. Specifically, I have the following where I am referencing an attribute value:
where the expression could have the hypothetical values of:
I am attempting to replace the ending substring WITHIN the string returned from the expression above as such:
So that I get:
However, when I do this, I actually get the literal value of:
Under the section describing the NiFi expression language in https://docs.hortonworks.com, it says we can "chain together multiple function calls". However, I'm unsure of whether this works for string manipulations. Just to check, I reversed the order of chaining and performed the replace BEFORE the substringAfter and still got the same behavior. Additionally, I tried performing the replace alone, and apparently it did not like the embedded numbers. Can anyone shed any light this or present a viable alternative solution? Thank you.
What you are trying to do is supported by NiFi Expression Language (EL).
Your "literal value" example output show a "." instead of ":" before replace.
What processor are you using this EL statement in? Not all processor properties support NiFi expression language. Floating your cursor over the small "?" circle next to a property will produce a pop-up that will tell you if EL is supported:
Using the updateAttribute processor you would add a dynamic property with your EL statement as follows:
After the FlowFile passes through the updateAttribute processor and i look at the attributes on the file listed in the output queue, I see:
As you can see the value from the "path" variable on the source FlowFile was used and the output is correct based on how the EL statement was written.
***Note: you may want to include the "/" in your substringAfter or drop the "/" at the end of "/Absolute/Directory/Path/" or instead use the "substringAfterLast('/')" in your EL statement instead to avoid the double "//" in the result.
If you found this Answer addressed your original question, please take a moment to login and click "Accept" below the answer.