You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Ahmed Shaaban M. Abd El Megeed (Jira)" <ji...@apache.org> on 2021/12/23 14:09:00 UTC

[jira] [Commented] (NIFI-9490) Add a 'Use Expression Language' Replacement Strategy to ReplaceText

    [ https://issues.apache.org/jira/browse/NIFI-9490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17464581#comment-17464581 ] 

Ahmed Shaaban M. Abd El Megeed commented on NIFI-9490:
------------------------------------------------------

Hi Mark,

I am a bit confused. The replacement value already supports expression language. If we take one of the examples you provided, ${'$1':toUpper()} give the same intended result of making the line upper case. 

 

> Add a 'Use Expression Language' Replacement Strategy to ReplaceText
> -------------------------------------------------------------------
>
>                 Key: NIFI-9490
>                 URL: https://issues.apache.org/jira/browse/NIFI-9490
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Mark Payne
>            Priority: Major
>
> When we have data that requires multiple transformations, the typical solution is to chain together multiple instances of ReplaceText. But this is expensive. It has to read & write the content multiple times. We also have to use Regex and are limited in the types of transformations that we can perform.
> We should add a new Replacement Strategy of "Use Expression Language." When selected, the Search Value should be ignored (and should be hidden via dependent properties). The Replacement Value should allow for Expression Language and should be provided FlowFile attributes as well as a variable named text that is to be evaluated. If the Evaluate Mode is Line-by-Line, it should also be provided a variable named lineNo that indicates the 1-based line number that is being evaluated.
> This allows for powerful transformations, such as:
> {\{ ${text:toUpper()} }} to make the line uppercase
> {\{ ${lineNo}: ${text} }} to prepend each line of text with a line number followed by a colon
> And many other possibilities that are not easily available today.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)