Creating a Variable

User: "amotley"
New Altair Community Member
Updated by Jocelyn

In one of my processes, I use the aggregate operator to add up all the footage of all the rows in my data set. Once I have this, I am trying to calculate the percentage of each row's footage to this total footage. I am using the generate attribute operator for this, and have FOOTAGE/#. # represents the total footage calculated  in the aggregate step that I have to manually put in to that function. 

 

Is there a way I can assign the total footage to a variable that I can pull back into that function later? I would like to do this so I do not have to manually enter in the total footage number everytime fo reach row. 

 

Thank you!

Find more posts tagged with

Sort by:
1 - 5 of 51
    User: "YYH"
    Altair Employee

    Hi Amotley,

     

    Have you tried to 'Extract Macro' in your process? You can

    (1) aggregate and find total footage

    (2) extract total footage and keep it in a macro %{TOT_FOOTAGE}

    to do this, you may set macro as 'TOT_FOOTAGE', macro type as 'data_value' and example index as 1 in 'extract macro' operator

    (3) use 'generate attribute' to add a new attribute, say attributed named percentage and its function expression could be FOOTAGE/%{TOT_FOOTAGE}, then each row's footage devided by %{TOT_FOOTAGE} is the percentage you wanted to achieve.

     

    I hope this heps.

     

    YY

    User: "amotley"
    New Altair Community Member
    OP

    YY,

     

    I tried this, but when I tried to run the process it came up with a "Undefined macro: TOT_FOOTAGE" error message. 

    Did I do something wrong?

    User: "YYH"
    Altair Employee
    Could you check the execution order of operators? If the macro is setup before it is used, it should be fine. Let me share a sample process later today.
    User: "YYH"
    Altair Employee
    User: "YYH"
    Altair Employee

    Sample process 

     

    Extract Macro.rmp

     

    https://dl.dropboxusercontent.com/u/12092138/Extract%20MACRO.rmp

     

    For some reason I dont know, I can not upload the rmp file here (it keep complain "The contents of the attachment doesn't match its file type")