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.  New BRE User - Date Calculation

    Employee
    Posted 03-29-2013 08:58

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

    Originally posted by: mw9286

    How do I add a new field to an output and what node should be used. I want to calculate how many days since a customer ordered service based upon order_date field in the existing output table. In SQL I what write it as ((current_date - order_date) Days active.


  • 2.  RE: New BRE User - Date Calculation

    Employee
    Posted 03-29-2013 09:52

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

    Originally posted by: xathras

    hi mw9286, assuming you want this per record you can add a filter node and use the date subtract function to get the difference. I'll see if i have an example somewhere.

    Wayne


  • 3.  RE: New BRE User - Date Calculation

    Employee
    Posted 03-29-2013 10:43

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

    Originally posted by: mw9286

    Hi Wayne:

    Thanks for the information.

    I see how the dateSubtract function works if I am comparing two date fields that exist in an output report.

    Now I need to find if there is a term like current_date or SYSdate that can be used in the function. (dateSubtract(CURRENT_DATE,ORDER_DATE)


  • 4.  RE: New BRE User - Date Calculation

    Employee
    Posted 03-29-2013 11:57

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

    Originally posted by: stonysmith

    All you need is date()

    dateSubtract(date(),ORDER_DATE)


  • 5.  RE: New BRE User - Date Calculation

    Employee
    Posted 05-30-2018 06:38

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

    Originally posted by: ryanderson08

    I'm using dateSubtract where there are some null values. I'm trying to handle the null values by using dateSubtract(date(1999,12,31),FieldName) and I'm getting different results for multiple rows.


  • 6.  RE: New BRE User - Date Calculation

    Employee
    Posted 05-31-2018 04:46

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

    Originally posted by: awilliams1024

    Hi

    If I use dateSubstract() on some sample data I always get the same result if the input field contains Null - i.e. the output is also NULL

    node:Filter
    bretype:core::Filter
    editor:sortkey=5b0fdf2525ab0d96
    input:@40fd2c74167f1ca2/=Sample_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    # dateSubtract(date(1999,12,31),FieldName)
    
    diff = dateSubtract(date(1999,12,31),dueDate)
    
    
    emit *, diff
    
    EOX
    editor:XY=450,160
    end:Filter
    
    node:Sample_Data
    bretype:core::Static Data
    editor:Label=Sample Data
    editor:sortkey=5b0fde7e54a61cf0
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    id:int,dueDate:date
    1,2018-01-01
    2,NULL
    3,2018-02-02
    4,NULL
    5,2018-04-02
    EOX
    editor:XY=330,160
    end:Sample_Data
    Would you be able to post a small sample of the input data that will exhibit this issue you are seeing?

    Thanks,
    Adrian