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.  Ranking Sequencing

    Employee
    Posted 03-02-2011 11:41

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

    Originally posted by: rbonneux

    I'm trying to sequence some sorted input which is sorted by order number and date. The sequence must restart for every new order number.

    For example this is the input

    INTORDER TASK_DATE TASK
    1 jan 01 1:00pm open
    1 jan 01 2:00pm update
    2 feb 01 8:00am open
    2 feb 01 8:30am update
    2 feb 01 8:40am print
    2 feb 04 4:00am Call
    2 feb 05 3:00am Comp
    3 Jan 01 8:00am open
    3 Jan 04 4:00am Call
    3 Jan 05 3:00am Comp

    This is what i want the output to look like withe the TASK_SEQ field

    INTORDER TASK_DATE TASK TASK_SEQ
    1 jan 01 1:00pm open 1
    1 jan 01 2:00pm update 2
    2 feb 01 8:00am open 1
    2 feb 01 8:30am update 2
    2 feb 01 8:40am print 3
    2 feb 04 4:00am Call 4
    2 feb 05 3:00am Comp 5
    3 Jan 01 8:00am open 1
    3 Jan 04 4:00am Call 2
    3 Jan 05 3:00am Comp 3



    INTORDER

    I've tried the logic below, as well as some variations.

    rank_num = 0;
    Currnent_order_number = -1;

    if(INTORDER == Currnent_order_number)
    then
    {
    rank_num = rank_num+1
    }
    else
    {
    rank_num = 1
    Currnent_order_number = INTORDER
    }

    override emit Currnent_order_number,rank_num,*


    Do you know if it is possible perform this in lavastorm?


  • 2.  RE: Ranking Sequencing

    Employee
    Posted 03-02-2011 12:18

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

    Originally posted by: timonk

    Rbonneux,

    Hello.
    You can accomplish this with a basic AGG node using the following type of BRAINScript:

    SCRIPT:
    -----------
    if firstInGroup then COUNT = 0
    COUNT = COUNT +1
    emit * , COUNT as "Sequence Number"
    -----------

    GROUPBY:
    INTORDER

    The key here is to remove the default "where lastInGroup statement"

    Regards
    Timon Koufopoulos
    MDA Support.


  • 3.  RE: Ranking Sequencing

    Employee
    Posted 03-02-2011 13:20

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

    Originally posted by: rbonneux

    Thanks works Perfectly!!!