How to add numeric fields together | Community
Skip to main content
Level 2
Sep 9, 2021 8:06 PM UTC
Solved

How to add numeric fields together

I knew how to do this once, but have now forgotten.

 

I have a form where I need to sum the values from 7 fields into an 8th one.

I've tried using JavaScript and FormCalc and tried all sorts of scripting examples but I can't make it work.

Perhaps I have the fields buried too deep inside sub sub forms?

I know it should be a basic thing to do, but my brain is just not working right now.

I'd appreciate any help.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Lavanya_Pejjayi
Lavanya_PejjayiAccepted solution
Employee
Sep 13, 2021 5:19 AM UTC

Can you try changing it to "antiracism" or "anti_racism" under the subform "grandchallengesyessf"

Sum(antiracism, quantumscience, climateresilence, scienceliteracy, earlychildhood, sustainablefood, healthequity)

 

from 

 

Sum(anti-racism, quantumscience, climateresilence, scienceliteracy, earlychildhood, sustainablefood, healthequity)

 

I hope this will help.

6 replies

Level 2
Sep 15, 2021 10:01 PM UTC

Thank you all for your help.

It is greatly appreciated!

Translate
Kosta_Prokopiu1
Employee
Sep 13, 2021 7:18 AM UTC

the others have spotted the issue with the field name. 

Generally: Never use operators such as "-" or "+" in a field name even if Designer does not prevent you from doing so. Latest in scripting will this fall on your toes. If you want to structure your field names use "_" or camel case like quantumScience ...

Translate
radzmar
Level 10
Sep 9, 2021 8:18 PM UTC

In FormCalc you can use the Sum() method i the calculate event of the total field. Just add the names of the fields to be summarised.

 

Sum(anti-racism, quantumscience).
Translate
Level 2
Sep 9, 2021 9:55 PM UTC

I'm doing something wrong, since I'm getting an error message.

With FormCalc, run at Client...

 

form1.titlesponsorsf.titlesponsordatasf.grandchallengessf.grandchallengesyessf.totalpercentages::calculate - (FormCalc, client)

 

Sum(anti-racism, quantumscience, climateresilence, scienceliteracy, earlychildhood, sustainablefood, healthequity)

 

Translate
Lavanya_Pejjayi
Lavanya_PejjayiAccepted solution
Employee
Sep 13, 2021 5:19 AM UTC

Can you try changing it to "antiracism" or "anti_racism" under the subform "grandchallengesyessf"

Sum(antiracism, quantumscience, climateresilence, scienceliteracy, earlychildhood, sustainablefood, healthequity)

 

from 

 

Sum(anti-racism, quantumscience, climateresilence, scienceliteracy, earlychildhood, sustainablefood, healthequity)

 

I hope this will help.

Translate