Skip to main content
adobe5505
Known Participant
February 3, 2021
Question

Expression Advanced Action

  • February 3, 2021
  • 1 reply
  • 300 views

Hello, I have set up an Expression Advanced Action to display the sum of 2 variables and it works perfectly. I now want to extend that to calculating the sum of 9 variables total. Is there a way to include all the variables in one row such as V_Sum= V_1+V_2+V_3+V_4 etc., or do I need to set up and action another way such as calculating the sums of the different actions?

    This topic has been closed for replies.

    1 reply

    RodWard
    Community Expert
    Community Expert
    February 3, 2021

    You just add more line items that are Expression actions underneath the current one.  Each line begins with the total from the previous line.  The trick here is that you only add ONE of the variables to V_Sum at a time.

     

    So it looks like this:

    V_Sum = V_Sum + V_1

    V_Sum = V_Sum + V_2

    V_Sum = V_Sum + V_3

    etc.

    Stagprime2687219
    Legend
    February 3, 2021

    Another option is to pick Execute JavaScript instead of Expression and craft this a little more as you were thinking of it.
    I personally find this easier/faster than clicking out nine expression actions.

    In the JavaScript window you would type this particular calculation out exactly as you did in your question.

    Just don't forget the semi-colon on the end.

    V_Sum=V_1+V_2+V_3+V_4+V_5+V_6+V_7+V_8+V_9;

     

    adobe5505
    adobe5505Author
    Known Participant
    February 3, 2021

    Awesome thank you! That JavaScript was exactly what I needed!