Mark,

Thanks for your information.

It works for my one input.

But i have another one input which have *'07/01/2017 0-1' *column.


07/01/2017 0-1,Nick,22

.

.

07/01/2012 23-24,Sandy,35



Consider my input is as above, how to match last 48 hours record from the
current hour in nifi?

On Mon, Jan 23, 2017 at 8:23 PM, Mark Payne <[email protected]> wrote:

> Prabhu,
>
> I think the RouteText processor will give you what you need. If you set
> the "Matching Strategy" property to "Satisfies Expression,"
> then it will allow you to use the Expression Language to evaluate each
> line of text in the file. Each line of text is available using
> the "line" variable. So, for example, you could create a Property named
> "older.than.72.hours" with a value of something like:
> ${line:getDelineatedValues(2):toDate('MM.dd.yyyy
> HH:mm:ss'):toNumber():lt( ${now():minus(259200000)} )}
>
> The now():minus(259200000) means subtract 259200000 milliseconds (72
> hours) from the current date/time.
>
> So this will look at each line in the text file, get the second delineated
> value (by default it uses a comma as the delimiter), convert
> it to a date/time using the format of <month>.<day of month>.<4 digit
> year> <24-hour>:<minute>:<second>, and then convert
> that to a number (in milliseconds since midnight Jan. 1, 1970). It then
> compares this value to see if the value is less than the current
> date/time minus 72 hours.
>
> Each line of text that matches will be routed to 'older.than.72.hours'.
> Note, the outgoing FlowFiles may contain several lines of text
> each, though. It does not split the output into individual lines. You can
> do so if necessary via SplitText.
>
> Thanks!
> -Mark
>
>
> On Jan 23, 2017, at 5:23 AM, prabhu Mahendran <[email protected]>
> wrote:
>
> My input contains dateTime with hours like below.,
>
> *No,DateTime,Name,ID*
> *1,23.01.2016 09:02:21,Mega,201*
> *2,03.01.2016 10:02:23,Hema,202*
>
> Now i need to get 2nd Column ["02.01.2016 10:02:23"] and then compare it
> with current dateTime with milliseconds.
>
> After that if 2nd Column is in between past 72 hours and then insert into
> sql server.
>
> *For example.,*
>
>                  My Current DateTime is "*04.01.2016 10:23:21"*
>
>                 For 1st row.,
>
>                                      1,*23.01.2016 09:02:21*,Mega,201
>
>                                     =>Compare *23.01.2016 09:02:21* with 
> *04.01.2016
> 10:23:21 [Current Time].It couldn't insert into SQL Server due to *
> *DateTime*
> * is not past 72 hrs when it
>    compared  with current dateTime.                   *
>                 For 2 nd row,
>
>
>
>
>
> *2,03.01.2016 10:02:23,Hema,202                                    =>This
> Should be insert into SQL Server.Because it's date is "03.01.2016" and it
> is past 72 hour data by compare it with current datetime. *
>
> *How can i achieve my use case in Nifi Processors?*
>
> *Please stop me if anything am doing wrong,*
>
> *Thanks,*
> *prabhu*
>
>
>

Reply via email to