The ion platform gives you the ability to perform advanced calculations using advanced rules. You can use calculations to weight certain answers within your interactive experiences or to perform math to provide visitors with pricing for a product or service you offer.

**Weighting Responses**

When setting up an interactive experience like a quiz, you may want to tell visitors how many correct answers they received once they complete the quiz. To do so, you may use the “Save computed data” action to add a point for every time someone gives the correct answer.

You will find an example of this rule within the Lead Gen Quiz Quick Start experience. Within this experience, behind each correct answer, you will find a rule that adds a point to the “QuizScore” data field. You may use the plus sign with the Save computed into database action to add a point to a given field whenever a correct answer is given.

***NOTE:** The rule in this example also saves the answer given to the Quiz_01 field so it can be displayed again on a later page. Please also note that this rule was added directly to the button the respondent clicks to provide their answer to the question.

**Advanced Calculations**

The Save computed data can also be used to perform more advanced calculations. This action will be particularly handy for any experience where you may want to provide visitors with a price or other numeric value based on a response they give in your form.

For example, if you would like to provide visitors with a total price of widgets, you can add a field to your ion form which asks the visitor how many widgets they are interested in purchasing. You could then apply a rule to your form to calculate the total.

Let’s say each widget costs $25. Let’s also say that the field used in the form for visitors to enter the number of widgets is called “Units.” You may apply a rule that looks like the below to your form to calculate how much the total order would cost. In our example, we are saving the total cost into a “Total” data field. The "Units" field is added to the rule to dynamically use whatever value the respondent entered for the "Units" field in the live experience.

Content variables can then be used on the Thank You page to display the total cost of the order. To do so, simply type ${{Total}} on the Thank You page. When viewing the page live, {{Total}} will be replaced with the actual cost that is calculated through this advanced rule.

***NOTE:** You may set up more complex calculations than these examples. Please feel free to utilize parentheses to group operations and multiple content variables throughout the formula to perform more advanced calculations.

## Comments

1 comment

Can the QuizScore data then be retrieved to populate a chart?

Please sign in to leave a comment.