You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Krzysztof Zarzycki <k....@gmail.com> on 2018/11/06 11:01:23 UTC

Can I define variables using other variables (or expression language)?

Hi community,
I'm using Nifi Variable Registry (through UI). I would like to define one
variable using value from other variable, like:
env = staging
scratch_path=/${env}/scratch

I tried exactly that approach, but it didn't work, the variable
scratch_path gets value literally /${env}/scratch.

Do you know if it should or should not be possible? Maybe it's a good idea
for a feature request?

Thanks,
Krzysztof

Re: Can I define variables using other variables (or expression language)?

Posted by Koji Kawamura <ij...@gmail.com>.
Hi Krzysztof,

Currently, NiFi variables cannot refer other variables. But you may be
able to achieve the expected result if you combine multiple variables
within a single Expression Language.
For example, if the "scratch_path" is the one you need to use at
ListFile processor's "Input directory", then you can set an EL there:
- Variables
-- env=staging
-- scratch_path=scratch
- ListFile Input directory = /${env}/${scratch_path}

Having said that, I agree with you, referring other variable
capability would be nice to have.
Please feel free to file a JIRA.
https://issues.apache.org/jira/projects/NIFI

Thanks,
Koji
On Tue, Nov 6, 2018 at 8:01 PM Krzysztof Zarzycki <k....@gmail.com> wrote:
>
> Hi community,
> I'm using Nifi Variable Registry (through UI). I would like to define one variable using value from other variable, like:
> env = staging
> scratch_path=/${env}/scratch
>
> I tried exactly that approach, but it didn't work, the variable scratch_path gets value literally /${env}/scratch.
>
> Do you know if it should or should not be possible? Maybe it's a good idea for a feature request?
>
> Thanks,
> Krzysztof