Mika,
The values for the dynamic properties are the names of the lookup keys
themselves. On top of that for the CSV lookup table they’re indexed for
multi-column tables, so for your example you want to add a dynamic property bar
with the value foo.1 (see [1] for a template). The reason ${foo} doesn’t work
is twofold: (1) there’s no foo attribute yet so ${foo} is empty and so there’s
no key, and (2) it’s not indexed. I suppose this indicates the documentation
isn’t sufficient or that the CSV controller service is just confusing and
should work differently.
You might be wondering why the property values are the lookup keys. The answer
is that it’s very useful for use cases where you’re using FlowFile attributes
or contents to specify what the keys are. For example, you could imagine a flow
that is:
[GetHTTP to fetch some user profile JSON from a WS] -> [EvaluateJsonPath to
extract a zipcode attribute, let’s say 10453] -> [LookupAttribute to enrich the
user profile by doing a lookup for the key ${zipcode}, which is 10453, and then
stuffing the result, NYC, in the attribute location]
For your example, the key isn’t being generated from an existing attribute so
you don’t need an Expression Language expression.
As for it being official, I’ve been working on NIFI-3404 [2, 3] which I’ll
probably PR this week and then we’ll see what people think. I actually wasn’t
sure I was going to include the CSV controller service so your email couldn’t
have come at a better time.
If you have any feedback on the behavior of the CSV controller service, I’m all
ears.
1. https://gist.github.com/jfrazee/a3b5558882b45228f768ef8dabb9ef54
2. https://issues.apache.org/jira/browse/NIFI-3404
3. https://github.com/jfrazee/nifi/tree/NIFI-3404
> On Apr 16, 2017, at 1:50 AM, Mika Borner <[email protected]> wrote:
>
> Hi
>
> I'm struggling with the LookupAttribute Processor [1].
>
> My flowfile has an attribute "foo" with the value "foovalue1". I want to
> create a new attribute "bar", that matches foo's value (=>barvalue1).
> Therefore I have defined a csv lookup table like this:
>
>
> foo,bar
>
> foovalue1,barvalue1
>
> foovalue2,barvalue2
>
>
> Therefore I'm creating a new dynamic property "bar" with the value "${foo}".
> Unfortunately this does not work. Any hints?
>
> I think this processor is very useful. Will it be integrated into an official
> Nifi release anytime?
>
> Thanks
>
> Mika>
>
>
> [1]
> https://github.com/jfrazee/nifi-lookup-service/tree/file-based-lookup-service
>