Mark,

I didn't check with inferred schemas, but it seems to work well enough with
a defined one. We have a similar potential use case coming up where it
would be nice to be able to do something like this:

/full[*] => concat(../addresses[*]/street, .....)

With the goal being "foreach concatenated address, progressively build the
array of strings @ /full)

I poked around at the Record Path API, and found that WildCardIndex.java
might be a good place to put some logic for progressively building an
array. What are your thoughts?

Thanks,

Mike

On Thu, Sep 19, 2019 at 4:25 PM Mark Payne <[email protected]> wrote:

> Hey Mike,
>
> You *SHOULD* be able to do this with UpdateRecord by adding a property
> with the name /addresses[*]/full
> and then a value of `concat(../street, ' ', ../city, ' ', ../state)` and
> that should generate an output like:
>
> "addresses": [
>   { "street": "12345 Main St", "city": "Springfield": "state", "VA",
> "full": "12345 Main St Springfield VA" }
> ]
>
> But I tested that to make sure that it worked before responding. And...
> unfortunately it didn't work :( At least with an inferred schema.
> So I tracked down what was going on and filed a Jira [1]. I did put up a
> PR for it. So please do check it out if you get a chance.
>
> Thanks!
> -Mark
>
> [1] https://issues.apache.org/jira/browse/NIFI-6691
>
> On Sep 18, 2019, at 7:15 AM, Mike Thomsen <[email protected]<mailto:
> [email protected]>> wrote:
>
> If you have an array that looks like this:
>
> "addresses": [
>  { "street": "12345 Main St", "city": "Springfield", "state": "VA" }
> ]
>
> (With a dozen more addresses for the sake of argument)
>
> Is it possible to do something like this:
>
> concat(/addresses/street, ' ', /addresses/city, ' ', /addresses/state)
>
> With the end goal being that the concat is really run on each object within
> the addresses array and the result set is an array of concatenated objects?
>
> Thanks,
>
> Mike
>
>

Reply via email to