• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Expression Advanced Action

Community Beginner ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

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?

Views

187

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

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;

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources