Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EB0DA200C06 for ; Fri, 27 Jan 2017 08:10:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E99BC160B5B; Fri, 27 Jan 2017 07:10:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BF325160B47 for ; Fri, 27 Jan 2017 08:10:56 +0100 (CET) Received: (qmail 8378 invoked by uid 500); 27 Jan 2017 07:10:50 -0000 Mailing-List: contact users-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@nifi.apache.org Delivered-To: mailing list users@nifi.apache.org Received: (qmail 8368 invoked by uid 99); 27 Jan 2017 07:10:50 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jan 2017 07:10:50 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 5EE5718C869 for ; Fri, 27 Jan 2017 07:10:50 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.689 X-Spam-Level: ** X-Spam-Status: No, score=2.689 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 2CmV-8KqqO7K for ; Fri, 27 Jan 2017 07:10:48 +0000 (UTC) Received: from mail-qt0-f175.google.com (mail-qt0-f175.google.com [209.85.216.175]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 89C245F30B for ; Fri, 27 Jan 2017 07:10:47 +0000 (UTC) Received: by mail-qt0-f175.google.com with SMTP id v23so118081888qtb.0 for ; Thu, 26 Jan 2017 23:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=N1Stzrt5hW2f0xiFPglCPVDtdJ4Xh5knfyc5Mnqw9ZI=; b=l1D2rb19XeIrRssf4+me/9EcPCeccF5H+oZgczK6rdVutjDdBrX+T3jUBaU5G/BVzU WLbLlbSwBc2e/PedpY2HHEKEBMiGnDdeOz2/Zpmq7acZ5gCZlx+3DHKGEMSkUj4uG7+d qWbVoXlwQf1oInkkQPpm6rBeU9prXGyAIqkYDhVZaVr/i9HO0Hc28dDRCCymW2Qbn7Ew flF78jx+dzA3YabwJmn+QiFAyF7yRCsHErqMPaOYR4aNxfpucgO0IPeEbuupvWlk/T/K XQoDes1K+7SzwVsyTbwTT6Ic9Cl7/SNFH/Arv2Myugovr01FHkqAY7TH7Yy7/Cvy2Suk wNyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=N1Stzrt5hW2f0xiFPglCPVDtdJ4Xh5knfyc5Mnqw9ZI=; b=YoJWiK1cChkU5tT0WcRq6vfQL991KTBNbkkoJBGXQLhto8HJK3V3Pr7Xa6jK4KLGDO cZX/tkCEPMP4kGQYoIAlQcPGLb42Cd479R5sqzdoqX/bvLDS4h4jrbSmQbMtgJ29Qwue nWOSoE5FVumY/ROU52o6QdW1xMm62FnUS7SDeIkx5XdJ7a7NuXEPbTMLZLECqDteDTt0 T28Kb9eDvj6acq34K3Hv5jrHkNXD+ginFdXgMvxmedz50C3mHR0ef9Hf1Pd3xUrJm3t0 i1J5KnYyT6f4tpesY+Y6vOvnjHi26jn7MiseXrDnLEqbnfPrCNhfDhBfmIXbKoKZWjZO Qlkg== X-Gm-Message-State: AIkVDXLIkgelMhrFCSToUTZ8C+dLFJxFEayVG+BhUZR2+/gtBH1cs4m4VXhCGmjxqWo0wiu95DCczmxrC5dPcA== X-Received: by 10.233.237.13 with SMTP id c13mr7290483qkg.227.1485501043903; Thu, 26 Jan 2017 23:10:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.81.175 with HTTP; Thu, 26 Jan 2017 23:10:43 -0800 (PST) In-Reply-To: References: From: Lee Laim Date: Fri, 27 Jan 2017 00:10:43 -0700 Message-ID: Subject: Re: Past month data insertion is possible To: users@nifi.apache.org Content-Type: multipart/alternative; boundary=94eb2c0c129c09166605470e2a28 archived-at: Fri, 27 Jan 2017 07:10:58 -0000 --94eb2c0c129c09166605470e2a28 Content-Type: text/plain; charset=UTF-8 In that case, Extract the 'month' and 'year' using ExtractText. Followed by RouteOnAttribute to send all months except January to an updateAttribute processor that would decrement the month. previous_month: ${month:minus(1):toRadix(10,2)}, and set year_prime as the year The exception is January which would be routed to a branch where previous_month would be set to 12, and the year would be decremented ${year:minus(1)}, and stored as an attribute called year_prime . The 2 branches could then be funneled back to the same flow. On Thu, Jan 26, 2017 at 11:33 PM, prabhu Mahendran wrote: > Lee, > > This case may not be work for me. > > > > Actually I want like this: > > > > Input given - Output Expected > > 01-2017 - 12-2016 > > 05-2017 - 04-2017 > > > > If my input is the current month with year, output expected is the last > month cross checked with the year(have to consider the year also, for the > case January month). > > > > Your answer may satisfy the less than condition for all the previous > months. > > On Fri, Jan 27, 2017 at 11:43 AM, Lee Laim wrote: > >> Prabhu, >> >> Using epoch time might end up being a simpler comparison. If the >> converted date is less than >> 1483254000 (midnight of first day of current month), it is the previous >> month (for my timezone).Thanks, >> Lee >> >> >> On Thu, Jan 26, 2017 at 10:42 PM, prabhu Mahendran < >> prabhuu161994@gmail.com> wrote: >> >>> Hi Andy, >>> >>> i have already tried with your alternative solution. >>> "UpdateAttribute to add a new attribute with the previous month value, >>> and then RouteOnAttribute to determine if the flowfile should be >>> inserted " >>> >>> i have used below expression language in RouteOnAttribute, >>> >>> >>> *${literal('Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'):getDelimitedField(${csv.1:toDate('dd.MM.yyyy >>> hh:mm:ss'):format('MM')}):equals(${literal('Dec,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov'):getDelimitedField(${now():toDate(' >>> Z MM dd HH:mm:ss.SSS yyyy'):format('MM'):toNumber()})})}* >>> >>> >>> it could be failed in below data., >>> >>> *23.12.2015,Andy,21* >>> *23.12.2017,Present,32* >>> >>> >>> My data may contains some past years and future years >>> >>> It matches with my expression it also inserted. >>> >>> I need to check month with year in data. >>> >>> How can i check it? >>> >>> >>> On Fri, Jan 27, 2017 at 10:52 AM, Andy LoPresto >>> wrote: >>> >>>> Prabhu, >>>> >>>> I answered this question with an ExecuteScript example which will do >>>> what you are looking for on Stack Overflow [1]. >>>> >>>> [1] http://stackoverflow.com/a/41887397/70465 >>>> >>>> Andy LoPresto >>>> alopresto@apache.org >>>> *alopresto.apache@gmail.com * >>>> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 >>>> >>>> On Jan 26, 2017, at 8:40 PM, prabhu Mahendran >>>> wrote: >>>> >>>> Hi All, >>>> >>>> I have data in which i need to compare month of data if it is previous >>>> month then it should be insert otherwise not. >>>> >>>> *Example:* >>>> >>>> *23.12.2016 12:02:23,Koji,24* >>>> 22.01.2016 01:21:22,Mahi,24 >>>> >>>> Now i need to get first column of data (23.12.2016 12:02:23) and then >>>> get month (12) on it. >>>> >>>> Compared that with before of current month like., >>>> >>>> >>>> *If current month is 'JAN_2017',then get before of 'JAN_2017' it should >>>> be 'Dec_2016'* >>>> For First row, >>>> >>>> *compare that 'Dec_2016' with month of data 'Dec_2016' *[23.12.2016]*.* >>>> >>>> It matched then insert into database. >>>> >>>> if it not matched then ignore it. >>>> >>>> is it possible in nifi? >>>> >>>> Many thanks, >>>> prabhu >>>> >>>> >>>> >>>> >>>> >>> >> > --94eb2c0c129c09166605470e2a28 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
In that case, =C2=A0Extract the 'month' and 'y= ear' using ExtractText.=C2=A0 Followed by RouteOnAttribute to send all = months except January to an updateAttribute processor that would decrement = the month. =C2=A0 previous_month: ${month:minus(1):toRadix(10,2)}, and set = year_prime as the year

The exception is January which would be= routed to a branch where =C2=A0previous_month would be set to 12, and the = year would be decremented ${year:minus(1)}, and stored as an attribute call= ed year_prime .

The 2 branches could the= n be funneled back to the same flow.


On Thu, Jan 26, 2017 at 11:= 33 PM, prabhu Mahendran <prabhuu161994@gmail.com> wrot= e:
Lee,

This case may not be work for me.

=C2=A0

Actually I want like this:

=C2=A0

Input given=C2=A0 -=C2=A0 Output Expected

01-2017=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -=C2=A0 12-2016=

05-2017=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -=C2=A0 04-2017=

=C2=A0

If my input is the current month with year, output expected is the last month cross checked wi= th the year(have to consider the year also, for the case January month).

=C2=A0

Your answer may satisfy the less than condition for all the previous months.


On Fri, Jan 27, 2017 at 11:43 AM, = Lee Laim <lee.laim@gmail.com> wrote:
Prabhu,

Using epoch time might end up being a simp= ler comparison. =C2=A0 If the converted date is less than=C2=A0

= 14= 83254000 (midnight of first day of current month), it is the previous month= (for my timezone).

Thank= s,

Lee<= /span>
=C2=A0<= br>

On Thu, Jan 26, 2017 at 10:42 PM, prabhu Mahendran <prabhuu16= 1994@gmail.com> wrote:
Hi Andy,

i have already tried with your alternative sol= ution.
"UpdateAttribute=C2=A0to add a new attribute with the previous month value, and then=C2=A0= RouteOnAttribute<= span style=3D"color:rgb(36,39,41);font-family:arial,"helvetica neue&qu= ot;,helvetica,sans-serif;font-size:15px">=C2=A0to determine if the flowfile= should be inserted "

i have used below expression langu= age in RouteOnAttribute,

${literal('Jan,Feb= ,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'):getDelimitedField(= ${csv.1:toDate('dd.MM.yyyy hh:mm:ss'):format('MM')}):e= quals(${literal('Dec,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,= Nov'):getDelimitedField(${now():toDate(' Z MM dd HH:mm:ss= .SSS yyyy'):format('MM'):toNumber()})})}


it could be failed in below data.,

23.12.2015,Andy,21
23.12.2017,Present,32

My data may contains some past years and future years
<= br>
It matches with my expression it also inserted.
I need to check month with year in data.

How can i check= it?
=C2=A0

On Fri= , Jan 27, 2017 at 10:52 AM, Andy LoPresto <alopresto@apache.org>= wrote:
Prabhu,=C2=A0

I answered this question with an= ExecuteScript example which will do what you are looking for on Stack Over= flow [1].=C2=A0


<= div>
Andy LoPresto
PGP Fingerprint:=C2=A070EC B3E5 98A= 6 5A3F D3C4 =C2=A0BACE 3C6E F65B 2F7D EF69

On Jan 26, 2017, at 8:40 PM, prabhu= Mahendran <prabhuu161994@gmail.com> wrote:

Hi All,

I hav= e data in which i need to compare month of data if it is previous month the= n it should be insert otherwise not.

Example:

23.12.2016 12:02:23,Koj= i,24
22.01.2016 01:21:22,Mahi,24

Now i need to get first column of data (23.12.2016 12:02:23) and then get = month (12) on it.

Compared that with before of current month like.,<= br>
If current month is 'JAN_2017',then get before of 'JA= N_2017' it should be 'Dec_2016'

For First row,
compare that 'Dec_2016' with month of data 'Dec_2016' = [23.12.2016].

It matched then insert into database.
if it not matched then ignore it.

is it possible in nifi?

Many thanks,
prabhu







--94eb2c0c129c09166605470e2a28--