Calculate - Mismatched brackets error

283
4
07-11-2021 06:41 PM
KathleenHoenke
Occasional Contributor

I have a pretty complicated self scoring survey123 form, and I'm getting a mismatched brackets error for an equation that seems to not have mismatched brackets. 

 

 

 

1/(1+(pow(2.718,(10*(${InletPerchLow}-0.5))))

 

 

 

When I change to the following, I get an unexpected beginning of path.

 

 

1/(1+pow((2.718,(10*(${InletPerchLow}-0.5)))))

 

 

Any advice would be great!

0 Kudos
4 Replies
jcarlson
MVP Notable Contributor

One of the problems with complex formulas in Survey123 is that it can often be easy to lose track of your formula. It might help to write it out in an IDE first to keep things straight.

1 / (
  1 + (
    pow(
      2.718, (
        10 * (
          ${InletPerchLow)-0.5
        )
      )
    )
  )
 <------ missing bracket

 

Writing out your expression as you have it written, it would appear you're missing a single ')' at the end.

- Josh Carlson
Kendall County GIS
0 Kudos
KathleenHoenke
Occasional Contributor

Thank you! When I add one on the end, then I receive the error:  Unexpected beginning of Path in expression

0 Kudos
jcarlson
MVP Notable Contributor

I broke it out step by step, and it appears that it's the "1 / " that is the problem. Instead, try using this:

 

 

pow((1+pow((2.718,(10*(${InletPerchLow}-0.5))))), -1)

 

 

It's mathematically equivalent, but Survey123 seems to not have a problem with doing it this way.

jcarlson_1-1626058570928.png

 

- Josh Carlson
Kendall County GIS
0 Kudos
KathleenHoenke
Occasional Contributor

Thank you! It appears that division has to be represented by "div" in the XLS form. I changed it to div and added the bracket you suggested and it worked!

 

 

 

0 Kudos