Title: Formula Editing
Last modified: July 25, 2017

---

# Formula Editing

 *  Resolved [sameagol](https://wordpress.org/support/users/sameagol/)
 * (@sameagol)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/)
 * Hi, I’m wondering about the functionality of the formula editor. I would like
   to be able to have an if() then statement. For example:
 * if(x > a){result = a}else{result = x}
 * I like the plugin, but I can’t use it without this kind of functionality.

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Contributor [ustimenko](https://wordpress.org/support/users/ustimenko/)
 * (@ustimenko)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9349494)
 * You can have two results and for first use formula `x>a`
    and for 1nd — `NOT(
   x>a)`
 * But I think you need something like [Computed variables](https://apsiholog.ru/addons/docs/4-computed-variables.pdf)
   add-on.
 *  Thread Starter [sameagol](https://wordpress.org/support/users/sameagol/)
 * (@sameagol)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9351612)
 * I appreciate the timely response. Can variables store non-booleans, like ints
   or floats?
 *  Plugin Contributor [ustimenko](https://wordpress.org/support/users/ustimenko/)
 * (@ustimenko)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9352037)
 * [@sameagol](https://wordpress.org/support/users/sameagol/) varaibles can store
   ints, floats and strings.
 * Computed vars operates with ints/floats.
 * NOt-zero var in result’s formula becomes true.
 * See here for tech details: [https://github.com/garex/wp-testing/blob/368b6ae10f009443e4cc8ba2675c7589433fe7b5/src/Model/Compilable.php#L93:L117](https://github.com/garex/wp-testing/blob/368b6ae10f009443e4cc8ba2675c7589433fe7b5/src/Model/Compilable.php#L93:L117)
 *  Thread Starter [sameagol](https://wordpress.org/support/users/sameagol/)
 * (@sameagol)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9352866)
 * I see how it takes ints, floats, and strings.
 * I’m still trying to figure out how to store something like this in variables:
 * if(x > a){result = a}else{result = x}
 * Can this be done using computed variables:
 * [result = a] [x > a]
    [result = x] [x >= a]
 *  Plugin Contributor [ustimenko](https://wordpress.org/support/users/ustimenko/)
 * (@ustimenko)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9352872)
 * Yes.
 * For example in compuvars:
 * is_x_big: `x > a`
    is_x_less: `NOT(is_x_big)` is_result_a: `is_x_big` is_result_x:`
   is_x_less`
 * Then in formulas just:
 * result a: `is_result_a`
    result x: `is_result_x`
 *  Thread Starter [sameagol](https://wordpress.org/support/users/sameagol/)
 * (@sameagol)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9355435)
 * I am sorry for being unclear. In your example, you have two results, result a
   and result b.
 * I am looking for functionality which can assign either a or x to the same result.
 * if(x > a){result = a}else{result = x}
 * I hope this is possible! Thanks again for all the answers.
 *  Plugin Contributor [ustimenko](https://wordpress.org/support/users/ustimenko/)
 * (@ustimenko)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9355646)
 * By “result” I understand a piece of text, that we show to respondent on results
   page.
 * Result will show if it’s formula is true.
    1. What do you understand by “result”?
    2. Why do you need it?
    3. Where do you want it to use?
 *  Thread Starter [sameagol](https://wordpress.org/support/users/sameagol/)
 * (@sameagol)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9356618)
 * I should not have used the word “result.” I mean variable.
 * For example, I want to find the minimum of two variables and assign it to a different
   variable.
 * a is a variable
    x is a variable
 * minOfVariables = min(a,x)
 * I assume, if this is possible, one would have to have some kind of if statement,
   like:
 * if (x > a){minOfVariables = a}else{minOfVariables = x}
 * The reason I want to do this is because I’m doing some math on the scale scores.
   When doing math on these, it is important to be able to find the minimum or maximum
   of two variables to use later on.
 *  Plugin Contributor [ustimenko](https://wordpress.org/support/users/ustimenko/)
 * (@ustimenko)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9357658)
 * I’m still don’t understand the whole image.
 * Such if can be replaced by math.
 * Currently there is no “if”s in plugin and I dont’ plan to introduce em.
 * If your case is too advanced, then you shouldn’t use this plugin or can use it
   but with custom written addon, that uses some of plugin’s extension points.
 *  Thread Starter [sameagol](https://wordpress.org/support/users/sameagol/)
 * (@sameagol)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9358922)
 * Ok, thanks for the support. I’ll consider a custom addon, though I’m hesitant
   because I’m new to web code and wordpress. Thanks again!

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Formula Editing’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-testing_fff0ea.svg)
 * [Psychological tests & quizzes](https://wordpress.org/plugins/wp-testing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-testing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-testing/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-testing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-testing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-testing/reviews/)

## Tags

 * [wp-testing-formulas](https://wordpress.org/support/topic-tag/wp-testing-formulas/)
 * [wp-testing-support](https://wordpress.org/support/topic-tag/wp-testing-support/)

 * 10 replies
 * 2 participants
 * Last reply from: [sameagol](https://wordpress.org/support/users/sameagol/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/formula-editing/#post-9358922)
 * Status: resolved