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

using custom properties in Nifi

How would I use one custom property within another in Nifi? @Pierre Villard @Matt Burgess

Eg: I have

prop_1=/path/to/dir1

prop_2=/path/to/dir2

prop_3=${prop_1}/${prop_2}/file1

prop_4=${prop_1}/${prop_2}/file2

Now, within nifi processor, where expression language is supported, when I give

${prop_3} or ${prop_4}

I get error ${prop_1} is not a file or directory.

But if I provide the value as ${prop_1}/${prop_2}/file1, it works.

What is the problem when I give ${prop_3}?

Thanks,

John

3 REPLIES 3

Super Collaborator

Hi @John Carter,

This works provided first variables(prop_1,2) are evaluated and assigned to the second(prop_3,4) list.

Which implies the assignment can be done in two stages, assignment of first variables followed by a Update Attribute processor with second list

Here I have tested the same and able to use prop_3/4

First capture three variables fileName,appRootDir, rootDir

followed by a Update Attribute Processor which will assign these variables into a another variable.

40632-nifi-updateattribute.png

which eventually get the variable consolidated path:

40633-nifi-attributes.png

Hope this helps!!

@bkosaraju

I have these attributes in my custom property file and I would like to know if there is any possibility that I can directly use prop_3 without using any intermediate processor like update attribute?

Thanks

Please note that I have these properties defined in custom property file.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.