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.  How to create a duration accumulator

    Employee
    Posted 02-11-2011 12:41

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

    Originally posted by: zon


    Hi,

    I'm trying to create a rating for a voice product were customer has 200 min free for fixed line, and only after he reaches that volume, he will be charge.
    How can I create a accumulator in Lavastorm? What type of node should I use?

    Thankful for your help,

    ZON


  • 2.  RE: How to create a duration accumulator

    Employee
    Posted 02-11-2011 15:08

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

    Originally posted by: timonk

    Zon,

    Hello. This depends heavily on how you have your data organized. If you have a record set for this person, one way you could do this is to use an Aggregation node, which aggregates on the persons account or name (whatever their unique key is). As part of that aggregate, you create local variables to SUM the amount of usage and do any other checks you like. (say a variable TOTAL).

    The Aggregate node checks for the special booleans FirstInGroup and LastInGroup (for whatever your aggregate key expression was). You check for FirstInGroup to initialize any count/summing variables, and the node looks for LastInGroup as part of it's emit statement.

    You can create a local variable like
    TOTAL = 0 where firstInGroup
    TOTAL = TOTAL + USAGE

    Then you should be able to modify the output to look for the threshold barrier.

    emit *
    where lastInGroup or TOTAL > 200

    Of course you can output new fields at that point if you want, or alter a fields value.

    I recommend taking a look at your BRAINScript help file and the Aggregate node help file.

    Regards
    Timon Koufopoulos
    MDA Support.


  • 3.  RE: How to create a duration accumulator

    Employee
    Posted 02-14-2011 05:36

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

    Originally posted by: zon

    Hi Timon,

    Thanks for your fast answer.
    I try to do it and it runs (i've change to only appear the one that did pass). The only problem is that it doesn't return all record that it should. There are some original customers that don't appear in the agg output.
    It seems like he only gives me the firstInGroup for customers that did pass right in the first call. If customer only passed after 3tr call, no row data appears for this customer in agg output.

    My code is like:

    DURATION_ACUM = 0 where firstInGroup
    DURATION_ACUM = DURATION_ACUM + DURATION

    emit *, DURATION_ACUM where DURATION_ACUM > FREE_SEC

    Can you help?

    Best Regards,

    ZON


  • 4.  RE: How to create a duration accumulator

    Employee
    Posted 02-14-2011 08:30

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

    Originally posted by: timonk

    Zon,
    I'm sorry, I should have paid more attention to the details in some of my explanation. I was a bit too generic about the initial code. You should be using an IF clause for the accumulation variable. So it should read more like:
    "
    if firstInGroup then DURATION_ACUM= 0
    DURATION_ACUM= DURATION_ACUM+ DURATION

    emit * where lastInGroup or DURATION_ACUM> 10
    "
    (that is actual BRAINScript)

    Regards
    Timon