The Formula Editor is a tool in Grades that you can use to make Formula Grade Items or a Formula Grading System. In this article, you can read how to use the Formula Editor.
How does the Formula Editor work?
Use the Formula Editor to define a formula that calculates the value of a grade item based on other grade items (for example: to calculate final grades). When you create a formula, you have to assign grade items to the formula and define their relationship. These will be taking into account when calculating the desired grade item. An example of an easy formula is one that calculates the sum of a number of grade items. A more complicated formula could be one that drops the minimum or maximum value from a series of grade items.
The Formula Editor is available on the page New Item, Edit Item for Formula items, Edit Calculated Final Grade, Edit Adjusted Final grade, and the page for the Formula Grading Scheme.
For examples of formulas, please see this article.
Open the Formula Editor
- On the Manage Grades page, click on the name of a formula grade item that you would like to edit.
- Click on Edit using the Formula Editor
Most important Grades Formula Editor components
1. Formula field
The formula field is where the formula text is shown. The equal symbol (=) at the beginning of the formula cannot be removed. A cursor shows your position in the formula. Click on the formula field to place the cursor.
2. Cursor placement
The cursor placement pictograms are used to move your cursor back and forth in the formula. You can also move the cursor by clicking on a new location. There are four options:
- Move the cursor to the beginning of the formula.
- Move the cursor to the end of the formula.
- Move the cursor one element back.
- Move the cursor one element forward.
3. Grade item parameters
Use the Grade Item drop-down list to see which grade items you can add to the formula as a parameter. You can add numeric, pass/fail, selectbox, and Formula type grade items. You cannot reference to the formula grade item that you are defining (this prevents endless loops) or a final grade.
Use the Grade Item Value drop-down list to see values that have been linked to the grade item that you want to use in your formula. There are three options:
- Points Received: The grade the user achieved (e.g. 7 out of 10 points)
- Max points: the maximum amount of points that is available for a grade item (e.g. 10 points).
- Percentage: The percentage that the student has received (70%).
Click on Insert to add the selected grade parameter to the formula. Add a grade item to a formula in the following way:
- Select a grade item.
- Select the Grade Item Value that you want to use in the calculation.
- Click on Insert.
- For the weighted system, Grade item and category weights are ignored in the calculations.
- Dropped grade items and bonus grade items are calculated in the same way as other grade items.
4. Functions
The Function drop-down list contains a list of functions that you can use in your formula:
- MAX calculates the maximum value in a series of values.
- MIN calculates the minimum value in a series of values.
- SUM calculates the sum (total) of a series of values.
- AVG calculates the average of a set of values by adding all values and then dividing by the number of values.
- IF works as a boolean statement which returns the value that has been set as true or false. You have to define the condition (boolean statement), true (then) value, and false (else) value.
- Example: IF {condition assignment1.Points Received > 7.5, true (then) 10, false (else) 0}
- If the amount of points from assignment 1 is higher than 7,5, then the numerical value of 10 will be assigned, if not, then 0.
- NOT works as a boolean statement that returns a value that has been set to true if the condition is false, and return false if the condition is true.
- You can enclose functions.
- the Start, Next Term, and End options can be used to define elements in a function:
- Start: Starts the function that has been selected in the Function drop-down list with a bracket ( { ).
- Next Term: Adds a comma so that grade items or parts can be separated from a Boolean statement.
- End: Ends the function with a bracket ( } ).
Add a function in a formula
- Select a Function.
- Press Start.
- Add a parameter.
- Click on Next Term to add another parameter or use the numerical keys and operators to define a condition.
- Press End once you are done adding parameters and conditions.
5. Numerical keys and operators
The rightmost part of the formula editor contains several operators and a numerical keyboard to create formulas. These operators are usually used in combination with at least one Grade Item.
6. Backspace and Clear
The Backspace and Clear options can be used to delete parts of the formula so that you can make changes.
- Backspace removes the element left of the cursor.
- Clear deletes the entire formula.
7. Cancel
The Cancel button allows you to leave the formula editor without saving changes.
8. Insert
The Insert button validates the formula and applies this to the Grade Item or the final grade you are working on. If the formula is invalid, you will receive an error message and the cursor will move to the part of the formula where the mistake is detected. The error type will be shown in red above the formula.
9. Validate
The Validate button checks whether the formula is in line with the syntax of a standard formula. If the formula is valid, you will see a confirmation message. In case the formula is invalid, you will receive an error message and the cursor will move to the spot in the formula where the mistake is. The error type will be shown in red above the formula. Please see Possible error messages for a list of possible errors.
10. Preview
With the Preview option, you can check how your formula calculates the grades for the first 10 users of the user list. Click on Close if you are done reviewing the grades. If your formula is invalid, you cannot review the grade examples.
Possible error messages
Here you can find a list of several error messages that you can encounter when using the formula editor.
Error message | Description | Example | Correction |
---|---|---|---|
Unexpected [token_type]Bijvoorbeeld, Unexpected operator | The formula contains a function component in an unexpected location. | = 5=/1= (5+1)2 | Revise the formula = 5/1= (5+1)*2 |
Unbalanced parentheses | The formula contains a bracket for opening or closing without another bracket. | = 5+1) | Delete the bracket = 5+ 1 |
Missing end of function | The formula contains an unclosed function. | = SUM{[Item1.Points], [Item2.Points] | Close the function (add another bracket at the end of the formula) SUM{[Item1.Points], [Item2.Points]} |
Unexpected function end | The formula contains a closing bracket for a function that has no influence on the function. | = [Item1.Points]/2} | Delete the bracket = [Item1.Points]/2 |
Invalid number of operator parameters | The formula contains an invalid number of operator parameters | = [Item1.Points] + | Add parameters or delete operator= [Item1.Points] + [Item2.Points] |
Invalid number of function parameters | The function contains an invalid number of function parameters. | = SUM{}= IF{[Item1.Points]2,5} | Use the correct number of parameters.In SUM, at least 3. For IF, exactly 3 |
Numeric value expected | A Boolean statment or operator is added instead of a numeric value | = IF{52,1 OR 1,4}= SUM{1 = 2,3,4} | Correct parameters.= IF {BOOLEAN, TRUE, FALSE}= SUM {only numeric values...} |
Boolean value expected | A Boolean statement is not entered for a condition | = IF {MIN{4,5},100,0}= NOT{4} | Revise Boolean. = IF {MIN{4,5} 5, 100, 0} |
Invalid terminal | The formula uses a wrong terminal | = [Item1.Points] + 3.2.5 | Delete the mistakes = [Item1.Points] + 3.2 |