How to sum values - simple addition?

Hi everyone,

I’m stuck at something as simple as summing values server side (php model). I have these numerical values passed on:
image

And I just want to add them all together:
image

But what I get is a juxtaposition of the values, rather than a sum. The value is declared as number.
image
image

Any insights on what I’m doing wrong?

Convert them to numbers first :slight_smile: Post values are always strings.

1 Like

Fantastic, thanks @Teodor. I learned something new today.

Hi @Teodor,
I could do with your help again - I’m failing to sum values. This is how they are declared:
image
I’m trying to add them altogether and even reconverted them to number:
image
But the sum is not accurate.

What is not accurate there? Note that if a value is a number already, there is no need to convert it to number again.

image

Hi Teodor, the ouptut is 13 rather than 520. I double transfromed into number just in case, as I wasn’t getting anywhere.

but are you trying to sum these setvalues, as in the team_weekly_hours?

Screenshot 2023-04-07 at 17.52.39

As from what i see in the value there are different values summed:

Screenshot 2023-04-07 at 17.53.47

Damn @Teodor, I must have been so tired. I just did a straight sum of the right setvalues, and of course it works. Thanks for being that additional pair of eyes.

1 Like