LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Emit all records of definable month + x months

    Employee
    Posted 01-08-2015 21:37

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: mrbigglesdotnet

    Hi there,

    I have a data set where the records have a MONTH_START column with monthly data in the format of CCYY-MM-01 (e.g. May 2014 is recorded as 2014-05-01). I need to be able to emit all records that reside within a certain number of months from a definable month. The required records may cross years too.

    For example, I may need to emit 3 months worth of data covering Nov 2014, Dec 2014, and Jan 2015. Is there a script that will allow me to define a start month (like 2014-12-01 in column MONTH_START) and emit records from that start month plus the following 2 months?

    I tried the following but all it gave me was records from 2014-07-01:

    emit * where
    'Month_Start' == addDate(("2014-05-01".toDate("CCYY-MM-DD")),2,"months")

    Thank you.


  • 2.  RE: Emit all records of definable month + x months

    Employee
    Posted 01-09-2015 07:52

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    This will probably do what you need:

    sd="2014-05-01".toDate("CCYY-MM-DD"))
    emit * where
    'Month_Start' >= sd
    and
    'Month_Start' <= addDate(sd,2,"months")


  • 3.  RE: Emit all records of definable month + x months

    Employee
    Posted 01-11-2015 16:27

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: mrbigglesdotnet

    sd="2014-05-01".toDate("CCYY-MM-DD")
    emit * where
    'Month_Start' >= sd
    and
    'Month_Start' <= addDate(sd,2,"months")

    Awesome, that works perfectly. Thanks again!