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.  Retrieve next record data into single record

    Employee
    Posted 11-21-2014 02:07

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

    Originally posted by: khopkins

    Hello

    I have a list of historical event data with a date in each record of when the event was changed

    For example
    Event_No,created_date
    5534676,1131021
    5534676,1131025
    5534676,1131104
    5534676,1131107
    5534676,131111
    5534676,1131111
    5534676,1131115
    5534676,1131125

    I need to add in to each record the created_date from the record below so i can use dateSubtract on the dates to work out a date length it was in each stage.
    Does anyone have some brainscript or a graph that enables me to do this in version 4.5.3 please

    Regards,

    Keith


  • 2.  RE: Retrieve next record data into single record

    Employee
    Posted 11-21-2014 05:22

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

    Originally posted by: ThomasT

    I guess this is about the same as what you are looking for?

    node:Filter
    bretype:core::Filter
    editor:sortkey=541ad648752e70d2
    input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    if firstExec
    then {
    prevNum = created_date
    Olddate = 0}
    else {
    Olddate = prevNum
    prevNum = created_date}


    emit *, Olddate

    EOX
    editor:XY=350,130
    end:Filter

    node:Static_Data
    bretype:core::Static Data
    editor:sortkey=546f2c5578124ac1
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    Event_No,created_date
    5534676,1131021
    5534676,1131025
    5534676,1131104
    5534676,1131107
    5534676,131111
    5534676,1131111
    5534676,1131115
    5534676,1131125
    EOX
    editor:XY=220,130
    end:Static_Data


  • 3.  RE: Retrieve next record data into single record

    Employee
    Posted 11-21-2014 05:51

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

    Originally posted by: khopkins

    Hi Thomas,

    Thanks for that but not quite as i need to have the next records date in the first record
    eg

    Event_No,created_date,oldDate
    5534676,1131021,1131025
    5534676,1131025,1131104
    5534676,1131104,1131107
    5534676,1131107,1131111
    5534676,1131111,1131111
    5534676,1131111,1131115
    5534676,1131115,1131125
    5534676,1131125,0

    Regards,

    Keith


  • 4.  RE: Retrieve next record data into single record

    Employee
    Posted 11-21-2014 05:56

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

    Originally posted by: ThomasT

    Ahh.. Yes..
    What about this?

    node:Filter_4
    bretype:core::Filter
    editor:sortkey=546f34670ca42393
    input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    output:546f34ff57617e17/out2=
    prop:Script=<<EOX
    output 1 {emit *, execCount as "Row"}
    output 2 {emit *, execCount -1 as "Row" rename created_date as "Olddate"}

    EOX
    editor:XY=290,160
    end:Filter_4

    node:XRef
    bretype:core::X-Ref
    editor:sortkey=546f353d7fc324cb
    input:@45781ca80c2802d0/=Filter_4.40fd2c7420761db6
    input:@45781ca971fe502f/=Filter_4.546f34ff57617e17
    output:@45781cad02e051b0/=
    output:@457826825d7c2de0/=
    output:@4578268450ad5d88/=
    prop:LeftInputKey=<<EOX
    Row
    EOX
    prop:Script=<<EOX
    output 1 {
    emit 1:* exclude 'Row'
    where join.leftOrphan
    }

    output 2 {
    emit 1:*,2:Olddate exclude 'Row'
    exclude referencedFields(2,{{^RightInputKey^}})
    where join.match
    }

    output 3 {
    emit 2:*
    where join.rightOrphan
    }
    EOX
    prop:SortLeftInput=true
    prop:SortRightInput=true
    editor:XY=370,160
    node:Sort_2
    bretype:::Sort
    editor:shadow=45782670131b71e8
    input:@40fd2c743ebf4304/=
    output:@40fd2c746a2a3b47/=
    end:Sort_2

    node:Bypass_3
    bretype:::Bypass
    editor:shadow=4578267017753cec
    input:@45782010749f0c96/=
    input:@457820124fef7658/=
    output:@40fd2c7436717256/=
    end:Bypass_3

    node:Join
    bretype:::Join
    editor:shadow=457826701862249e
    input:@40fd2c745b6d7704/=
    input:@40fd2c74504921cd/=
    output:@40fd2c7430f76546/=
    output:@457826cc03a465f4/=
    output:@457826cc510c69e0/=
    end:Join

    node:Bypass
    bretype:::Bypass
    editor:shadow=4578267041681261
    input:@45782010749f0c96/=
    input:@457820124fef7658/=
    output:@40fd2c7436717256/=
    end:Bypass

    node:Sort
    bretype:::Sort
    editor:shadow=4578267075a60d09
    input:@40fd2c743ebf4304/=
    output:@40fd2c746a2a3b47/=
    end:Sort

    end:XRef

    node:Cat
    bretype:core::Cat
    editor:sortkey=546f361a37552443
    input:@40fd2c7476b11c42/=XRef.457826825d7c2de0
    input:546f361d70050d08/right orphans=XRef.45781cad02e051b0
    output:@40fd2c74676e03c3/=
    prop:ConcatenationMode=union
    editor:XY=450,160
    end:Cat

    node:Static_Data
    bretype:core::Static Data
    editor:sortkey=546f2c5578124ac1
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    Event_No,created_date
    5534676,1131021
    5534676,1131025
    5534676,1131104
    5534676,1131107
    5534676,131111
    5534676,1131111
    5534676,1131115
    5534676,1131125
    EOX
    editor:XY=170,160
    end:Static_Data


  • 5.  RE: Retrieve next record data into single record

    Employee
    Posted 11-21-2014 06:06

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

    Originally posted by: khopkins

    Thats pefect thank you for your help