Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Math Operations not working in Confiform

Erin Smith
Contributor
September 10, 2024

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.

1 answer

0 votes
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 10, 2024

You need to use something like ZEROIFEMPTY function if your fields allow empty values (not compulsory fields)

ZEROIFEMPTY("[entry.field1]") + ZEROIFEMPTY("[entry.field2]")

Alex 

Erin Smith
Contributor
September 10, 2024

The fields are set to 0 by default. Do I need the ("") around each field? 

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 10, 2024

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 

Erin Smith
Contributor
September 11, 2024

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". 

 

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 11, 2024

Could you share a formula that you have now?

Erin Smith
Contributor
September 11, 2024

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.

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 11, 2024

OK, looks good.. and what is not working for you? How do you test? 

Erin Smith
Contributor
September 11, 2024

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.

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 11, 2024

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?

Erin Smith
Contributor
September 11, 2024

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.

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 11, 2024

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

Erin Smith
Contributor
September 11, 2024

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".

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 11, 2024

Simple question - how the rule that sets the TotalScore is configured?

Erin Smith
Contributor
September 12, 2024

It is a Set Value Rule with this configuration:

TotalScore=[entry.Score]

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 12, 2024

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?

Video (on wiki.vertuna.com)

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(&quot;[entry.RScore]&quot;) + ZEROIFEMPTY(&quot;[entry.OScore]&quot;))</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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
atlassian, dance, gamification, badge, razzle dazzle, team '25 anaheim

Earn a one-day badge today and do the Atlazzle Dazzle! 🕺

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 post
AUG Leaders

Atlassian Community Events