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

how to prepend constant to attribute in the flow file

Solved Go to solution

how to prepend constant to attribute in the flow file

Explorer

Hi

I am trying to prepend constant to the attribute in flow file . I was used below flow

Details :

Input : Flow file contains only below value

{"project" :"ABC-11"}

Output : Flow file should has mentioned value

{"_id.project":"ABC-11"}

here prepending _id to the project attribute and followed below flow

source--> updateattribute->replacetext->put file

in updateattribute attribute defined the project filed as below

project ==> ${prepend(_id)projectid}

The Processor is giving error and refereed the nifi expression language guide , There is no function for prepending constant to attribute

Please suggest some idea/thoughts for resolving the issue. Thanks for time and support

1 ACCEPTED SOLUTION

Accepted Solutions

Re: how to prepend constant to attribute in the flow file

Super Guru

@Suresh Dendukuri

If your flowfile having only one key,value then use ReplaceText processor and configure the processor as shown below

91660-screen-shot-2018-10-09-at-61139-pm.png

We are searching for project literal value and replacing that with _id.project by using ReplacementStrategy as LiteralReplace.

Input:

{"project" :"ABC-11"}

Output:

{"_id.project":"ABC-11"}

View solution in original post

2 REPLIES 2

Re: how to prepend constant to attribute in the flow file

Super Guru

@Suresh Dendukuri

If your flowfile having only one key,value then use ReplaceText processor and configure the processor as shown below

91660-screen-shot-2018-10-09-at-61139-pm.png

We are searching for project literal value and replacing that with _id.project by using ReplacementStrategy as LiteralReplace.

Input:

{"project" :"ABC-11"}

Output:

{"_id.project":"ABC-11"}

View solution in original post

Re: how to prepend constant to attribute in the flow file

Explorer

Thanks for your time and help