Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Nifi Expression language: append or prepend the attribute with string "$$$"

Solved Go to solution

Nifi Expression language: append or prepend the attribute with string "$$$"

New Contributor

I have requirement where I need to append and prepend the attribute with "$$$". how ever, Nifi expression language is appending or prepending with "\$"

For example: if attribute named "myattr" value is "This is Test"

when I do ${myattr:prepend('$$$'):append('$$$')}

I am expecting "$$$This is Test$$$"

but the output is "\$This is Test\$"

Is there any way to append or prepend the attribute with "$$$"

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Nifi Expression language: append or prepend the attribute with string "$$$"

Super Guru

@Anil Reddy

use 9$ instead of 3$

${myattr:prepend('$$$$$$$$$'):append('$$$$$$$$$')}

in expression language if you use 3$ are results as 1$ so we need to use 9$ if you want 3$ sign to be added to the attribute value.

Input:-
"myattr" value is "This is Test"
expression:-
${myattr:prepend('$$$$$$$$$'):append('$$$$$$$$$')}
Output:-
$$$This is Test$$$
3 REPLIES 3

Re: Nifi Expression language: append or prepend the attribute with string "$$$"

Super Guru

@Anil Reddy

use 9$ instead of 3$

${myattr:prepend('$$$$$$$$$'):append('$$$$$$$$$')}

in expression language if you use 3$ are results as 1$ so we need to use 9$ if you want 3$ sign to be added to the attribute value.

Input:-
"myattr" value is "This is Test"
expression:-
${myattr:prepend('$$$$$$$$$'):append('$$$$$$$$$')}
Output:-
$$$This is Test$$$

Re: Nifi Expression language: append or prepend the attribute with string "$$$"

New Contributor

what might be the reason for the extra character '\' ?

Highlighted

Re: Nifi Expression language: append or prepend the attribute with string "$$$"

New Contributor

it seems like replaceText processor is replacing '$$$$$*' in the content to '\$' while replacing the flow file content!

seems like actual issue is I have an attribute namely "myattr"

when myattr is "$$This is test$$", if I replace the flowfile content with myattr, the content in the flowfile is "\$this is test\$"