Member since
08-07-2018
1
Post
0
Kudos Received
0
Solutions
08-09-2018
01:12 AM
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: /Absolute/Directory/Path/${path:substringAfter('FruitBasket')} where the expression could have the hypothetical values of: "/store/produce/FruitBasket/RedFruits.txt" "/store/produce/FruitBasket/YellowFruits.txt" "/store/produce/FruitBasket/OrangeFruits.txt" I am attempting to replace the ending substring WITHIN the string returned from the expression above as such: /Absolute/Directory/Path/${path:substringAfter('FruitBasket'):replace('RedFruits.txt', 'Apple1.txt')} or /Absolute/Directory/Path/${path:substringAfter('FruitBasket'):replace('YellowFruits.txt', 'Banana2.txt')} etc.. So that I get: "/Absolute/Directory/Path/Apple1.txt" or "/Absolute/Directory/Path/Banana2.txt" However, when I do this, I actually get the literal value of: "/Absolute/Directory/Path/${path:substringAfter('FruitBasket').replace('RedFruits.txt', 'Apple1.txt')}" 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. -Jay
... View more
Labels:
- Labels:
-
Apache NiFi