Sachith Muhandiram
Sachith Muhandiram

Reputation: 2972

How to map data from two flowfiles using apache-nifi

I have two apache-nifi flows. One taken from database and other coming from flowfile.

Taken from QueryDatabaseTableRecord processor. :

lat,long,location
232,3454,colombo
454,8834,kandy
438,94,galle

In my flowfile I have lat and long columns. What I want is compare lat, and long coming from two flows and if its match, add a new column to flowfile as location

The problem I am having is that(to use ExecuteScript), how to get values from both flows as they have identical names?

Or is there a way to use another processor to do this?

Upvotes: 0

Views: 573

Answers (1)

mattyb
mattyb

Reputation: 12083

Try LookupRecord with a DatabaseRecordLookupService instead of QueryDatabaseTableRecord. You should specify user-defined properties lat to /lat and long to /long and a Result RecordPath of /location. If the lat/long of the flow file match the lat/long of a database row, it should return the value of location.

Upvotes: 1

Related Questions