Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

how to prepend constant to attribute in the flow file

avatar
New Member

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

avatar
Master 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

avatar
Master 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"}

avatar
New Member

Thanks for your time and help