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.  Performing math function between two columns

    Employee
    Posted 08-02-2011 17:48

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

    Originally posted by: rbeliz000

    I have an x-ref output with multiple columns, I would like to create a new column (COL_C) which will be the difference of COL_A and COL_B.

    COL_A COL_B COL_C
    12 10 2
    26 16 10


    What is the best node and method for accomplishing this in brain.

    Beyond this I would like to only output the records in which COL_C is greater then 8. So with the above example the first records would be omitted.

    I am using BRE v 4.5.0.0 build 300

    Any help/suggestions would be greatly appreciated.

    thanks.
    RB


  • 2.  RE: Performing math function between two columns

    Employee
    Posted 08-03-2011 06:18

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

    Originally posted by: timonk

    RB,

    You can add columns and make conditional emits in any of the output statements the xref (or any node) uses. Here is a simple example graph I just did up. It does a quick xref on 2 different static datas, then does some simple math on the output.

    Is this the kind of thing you are looking for?

    Regards,
    Timon Koufopoulos
    MDA Support.
    Attachments:
    xref example graph.brg


  • 3.  RE: Performing math function between two columns

    Employee
    Posted 08-03-2011 07:02

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

    Originally posted by: rbeliz000

    Timon,
    Yes, that was very helpful. I can build from you example.

    thanks,

    RB


  • 4.  RE: Performing math function between two columns

    Employee
    Posted 03-20-2012 08:52

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

    Originally posted by: rbeliz000

    Looking for best way to perform a math function between two records in a table.
    Please reference the two tables below for additional information.
    • Table A represents original static table
    • Table B represents the desired end product

    Referencing the first 2 records in table B:
    You’ll note I am performing a subtract function between the first two records to get the difference column of 10.
    Logic =
    If account number is the same, subtract older revenue date from newer revenue date.

    Additional notes:
    • the below tables have mock data however data type is identical
    • actual tables will have 2-3 million records
    • output will need to have an adjustable parameter in the difference column. i.e. only output records which have a difference of > 10.

    Any guidance or suggestion on the best way to perform this in Brain would be greatly appreciated.

    Thanks,
    RB


    Table A
    ACCOUNT_NUMBER REVENUE_AMT REV_DATE COUNT
    002210532 46.99 3/15/2012 2
    002210532 56.99 3/16/2012 2
    870050232 155.8 3/11/2012 2
    870050232 138.85 3/13/2012 2
    871570132 106.94 3/12/2012 2
    871570132 123.89 3/16/2012 2
    874440232 96.94 3/16/2012 2
    874440232 113.89 3/17/2012 2
    877270232 74.99 3/11/2012 2
    877270232 54.95 3/12/2012 2
    895150232 141.89 3/11/2012 3
    895150232 131.89 3/14/2012 3
    895150232 139.85 3/16/2012 3
    910730132 71.9 3/1/2012 3
    910730132 126.9 3/13/2012 3
    910730132 143.85 3/14/2012 3
    910800132 36.99 3/15/2012 2
    910800132 31.99 3/16/2012 2
    914500132 29.99 3/11/2012 2
    914500132 33.97 3/12/2012 2
    915090132 66.94 3/14/2012 2
    915090132 85.93 3/17/2012 2


    Table B

    ACCOUNT_NUMBER REVENUE_AMT REV_DATE COUNT DIFFERENCE
    002210532 46.99 3/15/2012 2
    002210532 56.99 3/16/2012 2 10
    870050232 155.8 3/11/2012 2
    870050232 138.85 3/13/2012 2 -16.95
    871570132 106.94 3/12/2012 2
    871570132 123.89 3/16/2012 2 16.95
    874440232 96.94 3/16/2012 2
    874440232 113.89 3/17/2012 2 16.95
    877270232 74.99 3/11/2012 2
    877270232 54.95 3/12/2012 2 -20.04
    895150232 141.89 3/11/2012 3
    895150232 131.89 3/14/2012 3 -10
    895150232 139.85 3/16/2012 3 7.96
    910730132 71.9 3/1/2012 3
    910730132 126.9 3/13/2012 3 55
    910730132 143.85 3/14/2012 3 16.95
    910800132 36.99 3/15/2012 2
    910800132 31.99 3/16/2012 2 -5
    914500132 29.99 3/11/2012 2
    914500132 33.97 3/12/2012 2 3.98
    915090132 66.94 3/14/2012 2
    915090132 85.93 3/17/2012 2 18.99


  • 5.  RE: Performing math function between two columns

    Employee
    Posted 03-20-2012 08:57

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

    Originally posted by: rbeliz000

    tables.jpg

    tables A & B for reference


  • 6.  RE: Performing math function between two columns

    Employee
    Posted 03-20-2012 11:13

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

    Originally posted by: ltolleson

    Here is an example graph that should do what you want.
    Attachments:
    GroupSum_Example.brg


  • 7.  RE: Performing math function between two columns

    Employee
    Posted 03-20-2012 13:24

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

    Originally posted by: rbeliz000

    ltolleson, thanks for the help and reply.
    This seemes to do the trick.

    thanks.