Confiform "Set expression" does not work when field is updated by backspace

Alice Liu
Contributor
May 6, 2023

Hi Team,

I have set below structure for users to input several fields, and provide a total using Field Definition Rules with "set expression" to calculate total. The total can be successfully calculated in the beginning.

 

However, the problem is that if user updates any field with "backspace" instead of input "0," the "set expression" rule seems can not work and will return below message:

 

"COM.VERTUNA.CONFLUENCE.PLUGINS.CONFIFORMS.UTIL.EXPRESSION$EXPRESSIONEXCEPTION: TOO MANY OPERATORS OR FUNCTIONS AT: +"

 

It is weird because if user input "0," then the total can be calculated correctly. I have tested multiple times, and seems only "backspace" would cause the calculation fail.

Could you advise?

 

Ps. The structure:

- Field A: $user input amount

- Field B: $user input amount

- Fied C: read-only to display calculated result

 

- Rule 1 for Field A (calculate total when there is input):

condition = empty

action = set expression

value = Field C = [entry.Field A] + [entry.Field B]

 

- Rule 2 for Field A (put "0" when there is no input):

condition = empty

action = set value if empty

value = Field A = 0

 

Rules on Field B is similar to on Field A.

3 answers

1 accepted

2 votes
Answer accepted
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.
May 6, 2023

Hi @Alice Liu and welcome to this community

Fix your expression to handle the empty value

FieldC=ZEROIFEMPTY("[entry.FieldA]") + ZEROIFEMPTY("[entry.FieldB]")

Alex 

Alice Liu
Contributor
May 6, 2023

Hi Alex,

Thanks for the greeting and prompt reply!

 

I may not express my question clearly, but I did not set empty value rule on Field C.

The empty value "0" rule is set on Field A and Field B.

 

And my problem is that if in the beginning user input:

Field A = 100

Field B = 100

Then Field C can correctly display total 200.

But if then user use "backspace" to eliminate Field A's or Field B's value, then Field C will show the COM.VERTUNA message stated in my above post.

 

i.e. if afterwards user input:

Field A = 100 >> empty  (using "backspace" instead of input "0")

Field B = 100

Field C = COM.VERTUNA.CONFLUENCE.PLUGINS.CONFIFORMS.UTIL.EXPRESSION$EXPRESSIONEXCEPTION: TOO MANY OPERATORS OR FUNCTIONS AT: +

 

But if user input Field A = 100 >> 0, then Field C will show 200.

Hope this example explain better. Could you help to see what I can change to solve this problem?

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.
May 7, 2023

OK, and that is exactly what I was trying to help you with...

Let me try with the demo this time, I hope it helps

http://recordit.co/nAxvkpVRpp

Alex

Alice Liu
Contributor
May 8, 2023

Hi Alex,

The demo is very clear and helpful. I tried on my case and the problem is solved.

Thank you!

0 votes
Jonathan Saldarriag April 23, 2024

Hi @Alex Medved _ConfiForms_  I am getting this error: 

Expression: [*] could not be calculated, Too many operators or functions at: * 

and in some of the entries a 2 appears:

Expression: [*2] could not be calculated, Too many operators or functions at: *

The expression is quite simple and in some of the entries it works. The form itself is quite long, but the calculated field is only a multiplication between two fields:

Screenshot 2024-04-23 at 16.43.57.png

Then for evaluationIT we have:

Screenshot 2024-04-23 at 16.45.50.png

Then for evaluationDPO we have:

Screenshot 2024-04-23 at 16.46.08.png

And finally the calculated field is:

Screenshot 2024-04-23 at 16.46.22.png

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.
April 23, 2024

I believe what you are looking for is actually a formula field, not calculated - unless you want to calculate this only once, on record creation, and never recalculate

And to handle empty values, as explained in the comments here you will need to wrap the field values in the ZEROIFEMPTY functions

ZEROIFEMPTY("[entry.evaluationDPO]") * ZEROIFEMPTY("[entry.evaluationIT]")

Aex

0 votes
David C March 21, 2024

Hey @Alex Medved _ConfiForms_ , I am having an issue converting this to multiplicative form.

Capture.PNG

I have the following built with the following formula
MasterTechAgencyFee=ZEROIFEMPTY("[entry.MasterTechAgencyRate.masterpickagencyagencyrate]")*ZEROIFEMPTY("[entry.MasterTechAgencySalaryRequirement]")

 

Where the Agency Rate field is a smart field reference to another form (i.e. why I have .masterpickagencyrate on the end)

this should be providing an answer of 2 (100,000*.0002) but is instead providing 200,000 as the the answer.

 

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.
March 21, 2024

Sorry, but please provide a mathematically valid number - 0.0002

David C March 21, 2024

I'm attempting to multiply it by 20% (however.02 also did not work), (20%*100,000=20,000). I'm unsure of how .00002 is not a mathematically viable number?

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.
March 21, 2024

instead of .00002 put 0.00002

David C March 21, 2024

Thanks as always Alex, that seemed to do the trick.

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.
March 21, 2024

You are very welcome!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events