Workflow mathematical operators/calculated fields - strange results

Hey everyone!

I was trying some of the math functions in the workflow calculated fields.
I figured that it works quite well with just 2 parameters; however with multiple parameters it gets a bit…difficult :smiley:

Basically what I´m trying to achieve is to calculate the average value of 6 parameters in total, while 4 of the 6 parameters are being multiplicated with the factor 2. The remaining two parameters don´t get multiplied.

Therefore:

P0 → counts twice
P1 → counts twice
P2 → counts twice
P3 → counts twice
P4 → counts as one
P5 → counts as one

Mathematically put:

{(P02)+(P12)+(P22)+(P32)+(P41)+(P51)} / 10 = Average value

Now, unfortunately the “add” function only supports two parameters; therefore I had to create multiple add-calculations; in the end my attempt looks kind of like this:

{divide({add({add({add({multiply({P0};2)};{multiply({P1};2)})};{multiply({P2};2)};{multiply({P3};2)})};{P4};{P5})};10;)}

I think that the code should be right, but for some reason I keep getting very strange (and wrong) results…
Has anybody made some (positive or negative) experiences regarding the multiple use of mathematical operators in the Workflow module?

Any help would be appreciated!

Thanks and all the best

Rick

Just in case anybody is looking for this in the future, I´ve found the solution:

{divide({add({add({multiply({P0};2)};{multiply({P1};2)})};{add({add({multiply({P2};2)};{multiply({P4};1)})};{add({multiply({P3};2)};{multiply({P5};1)})})})};10;)}

The issue was that I forgot to place the add function later in the equation – compare both equations yourself and you´ll see :slight_smile:

1 Like