I have a form with 3 fields that are set to different numbers based on sections from Dropdowns. I have a 4th field that I want to be a calculation of the 3 fields above it.
I have tried setting the 4th field using a Set Value rule, as well as using a Formula field type. So the Formula field does the math and the Set Value rule sets the 4th field to the value of the Formula.
My math operation is [entry.field1] + [entry.field2] + [entry.field3]
But I keep getting the error message:
Expression: [+ +] could not be calculated, Too many operators or functions at: +
All field types are Numeric (except the Formula field which uses the Formula field type)
I'm sure it's obvious, but what am I doing wrong?
Thanks.
You need to use something like ZEROIFEMPTY function if your fields allow empty values (not compulsory fields)
ZEROIFEMPTY("[entry.field1]") + ZEROIFEMPTY("[entry.field2]")
Alex
The fields are set to 0 by default. Do I need the ("") around each field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, as you can see the error shows you what it was trying to calculate
Expression: [+ +] could not be calculated, Too many operators or functions at: +
This is all it had
+ +
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've copied exactly as above (replacing the field names), but it just gives "0" as the answer, it doesn't actually do the calculation.
If I remove the ZEROIFEMPTY part, it shows as "NA".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you share a formula that you have now?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the current formula:
ZEROIFEMPTY("[entry.RScore]") + ZEROIFEMPTY("[entry.OScore]")
RScore and OScore are Numeric fields that start at 0 and are populated based on a dropdown selection. I am currently testing using the top dropdown option that sets the value of RScore and OScore both to 30, so my total should be 60.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, looks good.. and what is not working for you? How do you test?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I choose the first option from the "R" dropdown (High) which triggers a "Set Value" rule to set RScore to 30. Same for OScore.
I have a field "TotalScore" that gets set to the value of the Formula that should be showing as 60, but only shows as 0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Formula gets calculated only on form submit - so, really not sure what are you doing
Or the "TotalScore" field is just a read-only field and you are using a Set Expression rule that is set to trigger on changes made to fields RScore and OScore?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
TotalScore is currently a numeric field that gets set to match the value of the formula. How do I tell it to set it on a change, as the user needs to see the total score to be able to best choose how to proceed with the questions on the remaining part of the form.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So much guessing, you could just share the config a bit more....
Where do you have this
ZEROIFEMPTY("[entry.RScore]") + ZEROIFEMPTY("[entry.OScore]")
?
A ConfiForms Field Definition Rule? Set Expression? How is it configured?
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Field "R" is a dropdown field (High/Medium/Low) When the user selects their choice a Set Value rule sets the Numeric Field "RScore" to a number (30/20/10)
The same for Fields "O" and "OScore"
The Field "Score" is a Formula field with the above formula.
A Set Value rule then sets the Numeric Field "TotalScore" to the calculated value of "Score" so it shows on the form for the user to determine next steps.
Currently "TotalScore" shows as 0 even after making the choices in "O" and "R".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Simple question - how the rule that sets the TotalScore is configured?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is a Set Value Rule with this configuration:
TotalScore=[entry.Score]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Formula is calculated on form submit, so what this "TotalScore=[entry.Score]" is suppose to do and WHEN? Who triggers this rule?
Very hard to understand your configuration to be honest, but I will try for one last time - see this video
Is it something what you have or want to achieve?
Configuration for the reference
<p><span> </span></p><ac:structured-macro ac:name="confiform" ac:schema-version="1" ac:macro-id="c408bb65-d1ca-464a-99a2-3cf8ddd89175"><ac:parameter ac:name="formName">form</ac:parameter><ac:rich-text-body><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="480af0db-7710-4b6e-886c-f33a3d367eb6"><ac:parameter ac:name="fieldName">R</ac:parameter><ac:parameter ac:name="fieldLabel">R</ac:parameter><ac:parameter ac:name="values">false[30=High|20=Medium|10=Low|]</ac:parameter><ac:parameter ac:name="type">select</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="a47e5480-ffb9-4280-bb5c-11e0837be114"><ac:parameter ac:name="fieldName">O</ac:parameter><ac:parameter ac:name="fieldLabel">O</ac:parameter><ac:parameter ac:name="values">false[30=High|20=Medium|10=Low|]</ac:parameter><ac:parameter ac:name="type">select</ac:parameter></ac:structured-macro></p><p><br /></p><p><ac:structured-macro ac:name="confiform-field-definition-rules" ac:schema-version="1" ac:macro-id="571724d3-f6e7-40b1-8dff-f73f68890636"><ac:parameter ac:name="values">RScore=[entry.R]</ac:parameter><ac:parameter ac:name="action">Set value</ac:parameter><ac:parameter ac:name="actionFieldName">R</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field-definition-rules" ac:schema-version="1" ac:macro-id="9e03bc2f-6106-4fb2-8415-83f1d6f0e771"><ac:parameter ac:name="values">OScore=[entry.O]</ac:parameter><ac:parameter ac:name="action">Set value</ac:parameter><ac:parameter ac:name="actionFieldName">O</ac:parameter></ac:structured-macro></p><p><br /></p><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="fa0f96ae-567a-4ebd-b3ea-7c4c577bbda5"><ac:parameter ac:name="fieldName">RScore</ac:parameter><ac:parameter ac:name="fieldLabel">RScore</ac:parameter><ac:parameter ac:name="type">number</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="96308325-9255-4fcc-af18-d47d56dfd39b"><ac:parameter ac:name="fieldName">OScore</ac:parameter><ac:parameter ac:name="fieldLabel">OScore</ac:parameter><ac:parameter ac:name="type">number</ac:parameter></ac:structured-macro></p><p><br /></p><p><ac:structured-macro ac:name="confiform-field-definition-rules" ac:schema-version="1" ac:macro-id="2d1292e8-610b-4ba7-9796-e03a23878662"><ac:parameter ac:name="values">TotalScore=(ZEROIFEMPTY("[entry.RScore]") + ZEROIFEMPTY("[entry.OScore]"))</ac:parameter><ac:parameter ac:name="action">Set expression</ac:parameter><ac:parameter ac:name="actionFieldName">RScore,OScore</ac:parameter></ac:structured-macro></p><p><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" ac:macro-id="bfcfb459-967c-4b0f-b2a5-0e3484aa396c"><ac:parameter ac:name="css">width:100px;</ac:parameter><ac:parameter ac:name="fieldName">TotalScore</ac:parameter><ac:parameter ac:name="fieldLabel">TotalScore</ac:parameter><ac:parameter ac:name="type">read_only</ac:parameter></ac:structured-macro></p><p><br /></p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" ac:macro-id="ef12e32e-1556-4478-a2a6-94cc0d2fb8bd"><ac:parameter ac:name="hideMetadata">true</ac:parameter><ac:parameter ac:name="formName">form</ac:parameter><ac:parameter ac:name="type">Embedded</ac:parameter><ac:parameter ac:name="debugMode">true</ac:parameter><ac:rich-text-body><p><br /></p></ac:rich-text-body></ac:structured-macro><p><br /></p><p><br /></p>
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Today only! Share what you’re the most excited about for Team ‘25 or just dance out the beginning of a new quarter with us.
Comment the postOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.