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.  Date filtering for a given month

    Employee
    Posted 01-28-2016 09:07

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

    Originally posted by: kmehta@maassmedia.com

    I have an IVR database set up and I want to use a filter node so that it would give me dates for a given range. For example: currently, it is set up to look for date =="20150101". How do I change that so it would filter dates for a month?


  • 2.  RE: Date filtering for a given month

    Employee
    Posted 01-28-2016 09:13

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

    Originally posted by: stonysmith

    One way is to do it like this:

    where year(myDate)==2015 and month(myDate)==01

    another would be

    where date(2015,01,01) <= myDate and mydate <= date(2015,01,31)


  • 3.  RE: Date filtering for a given month

    Employee
    Posted 01-29-2016 08:30

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

    Originally posted by: awilliams1024

    Hi,

    you may be interested to know there is also a range of (currently Experimental) nodes that simplify the process of filtering date-related records.
    The Experimental nodes are not visible in the BRE node library by default but can be made visible by: Selecting Tools --> Preferences from the BRE menu; then in the pop-up BRE Preferences panel clicking on the Advanced.. button and checking the Use Experimental Nodes checkbox; then Okay out of the panels.

    The date filtering nodes are available in the Aggregation and Transformation category. Here is an example that uses the N Period Date Filter node, the Filter By Date Range node and the Filter Dates Within Time Period node. Copy the code below into a blank BRE canvas:

    node:Filter_By_Dates_Within_Time_Period
    bretype:lal1::Filter By Dates Within Time Period
    editor:sortkey=56ab83ac10534379
    input:@40fd2c74167f1ca2/=Populate_the_Records.40fd2c7420761db6
    editor:bend=0=210|60
    editor:bend=0=210|250
    output:@40fd2c7420761db6/=
    prop:DateField=theDate
    prop:Num=1
    prop:ReferenceDate=2015-01-01
    prop:TimePeriod=months
    editor:XY=260,250
    editor:Doc=Extract records where the date is within 1 month of the specified date 
    editor:Doc=(the date can be before and after the specified date)
    end:Filter_By_Dates_Within_Time_Period
    
    node:Filter_By_Date_Range
    bretype:lal1::Filter By Date Range
    editor:sortkey=56ab85512f5d64f2
    input:@40fd2c74167f1ca2/=Populate_the_Records.40fd2c7420761db6
    editor:bend=0=210|60
    editor:bend=0=210|150
    output:@40fd2c7420761db6/=
    prop:DateField=theDate
    prop:FromDate=2015-01-01
    prop:ToDate=2015-01-31
    editor:XY=260,150
    editor:Doc=Extract records where the date value is between the specified dates
    end:Filter_By_Date_Range
    
    node:Populate_the_Records
    bretype:core::Filter
    editor:Label=Populate the Records
    editor:sortkey=56ab792813cb34b9
    input:@40fd2c74167f1ca2/=Create_Some_Null_Records.40fd2c7452fa204a
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    if firstExec then {
    	D = date(2014,12,01)
    	V = 1
    }
    
    emit D as "theDate"
    emit V as "theValue"
    
    D = D.dateAdjust(1, "days")
    V = V + 1
    EOX
    editor:XY=150,60
    end:Populate_the_Records
    
    node:Create_Some_Null_Records
    bretype:core::Dummy Input
    editor:Label=Create Some Null Records
    editor:sortkey=56ab76bf431b099d
    output:@40fd2c7452fa204a/=
    prop:Header=theDate:date, theValue:int
    prop:NumberOfRecords=100
    editor:XY=50,60
    end:Create_Some_Null_Records
    
    node:N_Period_Date_Filter
    bretype:lal1::N Period Date Filter
    editor:sortkey=56ab771d5c532788
    input:@5582949848733a91/=Populate_the_Records.40fd2c7420761db6
    output:@5582949802813e48/=
    prop:Date=2015-02-01
    prop:FieldName=theDate
    prop:PeriodSelection=Months
    prop:PeriodValue=1
    editor:XY=260,60
    editor:Doc=Extract records where the date is up to 1 month prior to the specified date
    node:Date_Filter
    bretype:::Date Filter
    editor:shadow=558a465b03a51102
    input:@40fd2c74167f1ca2/=
    output:@40fd2c7420761db6/=
    end:Date_Filter
    
    node:Dummy_Input
    bretype:::Dummy Input
    editor:shadow=558a465b4ff36934
    output:@40fd2c7452fa204a/=
    end:Dummy_Input
    
    node:Use_Parameter_Date
    bretype:::Use Parameter Date
    editor:shadow=558a465b39a35871
    input:@40fd2c74167f1ca2/=
    output:@40fd2c7420761db6/=
    end:Use_Parameter_Date
    
    node:Use_Current_Date
    bretype:::Use Current Date
    editor:shadow=558a465b5da63360
    input:@40fd2c74167f1ca2/=
    output:@40fd2c7420761db6/=
    end:Use_Current_Date
    
    node:Bypass
    bretype:::Bypass
    editor:shadow=558a465b23935a81
    input:@55829b2f7d787815/=
    input:@55829b311e3f3035/=
    output:@40fd2c7436717256/=
    end:Bypass
    
    node:Add_ToDate_to_data
    bretype:::Add ToDate to data
    editor:shadow=558a465b4c146d76
    input:@40fd2c746abc6dc7/=
    input:@40fd2c74486e4494/=
    output:@40fd2c7445835585/=
    end:Add_ToDate_to_data
    
    end:N_Period_Date_Filter

    These Experimental nodes were delivered in LAL 6.1.38.0 / LAL 6.0.38.0 so you will need to have this installed as a minimum or have LAE 6.1.1 (which includes a LAL version that contains these nodes). A caveat on the use of the Experimental nodes is that they are not covered by our support policy - see the relevant section in the release notes for details.

    Best Regards,
    Adrian