Coursedog

Submit a Ticket My Tickets
Welcome
Login  Sign up

CONFIGURING FIELD OPTIONS: Formula Fields


Table of Contents

Overview
How To Do It
Additional Notes
Curriculum Calculations Guide 
Scheduling Calculation Guide 
Related Articles


Overview

  • This article walks through adding custom formula fields to templates in Academic Scheduling and Curriculum Management. 

  • Formula fields allow you to use number fields in templates to automatically calculate other (net new) fields.

    • In Curriculum Management, you can add formula fields to Course or Program Templates to say things like “Student works hours = (lab hours + lecture hours) x 3” or “Tuition = total credit hours x 850”.

    • In Academic Scheduling, formula fields can calculate things like “Enrollment Utilization Rate = Actual Enrollment / Enrollment Capacity” and “Lecture Hours + Lab Hours = Contact Hours”.  


How To Do It

Step 1: Navigate to either: 

  • Curriculum > Settings > Course/Program Template > Custom Fields

  • Scheduling > Settings > Templates > Section Template > Custom Fields 


Step 2: Click and drag the formula field onto your template. 

Step 3: Click into the formula field you just added to your template in order to configure its question settings. 


Step 4: Select “Set Field Formula”. 

Step 5: Configure the formula in the modal. 

  • If you need information about the types of configurations available, they are referenced at the bottom of this article and can be accessed via the “Calculations Guide” included within the field’s Question Settings. 

 

Additional Notes

Configuration Updates | Dependent Field Change | Formula Field Using Another Field Formula
Section Rules | Nested Collection Fields | Support

Configuration Updates

  • If a formula is updated in the template question settings, the existing calculated data will not be updated automatically. 

  • The data will only be updated when the respective course, program, or section is manually updated. 


Dependent Field Change

  • If the dependency is required to make the formula work and the data in a dependent field is cleared, the previously saved data for the formula field will remain unchanged.

    • In other words, if removing the dependency prevents the formula from being executed correctly, the old value will remain unchanged. 

    • This data will only be updated when the respective course or program is updated with the new dependent data. 

    • If, for example, you have a common scenario like “Enrollment Utilization Rate = Actual Enrollment / Enrollment Capacity” and Enrollment Capacity is returned to a null value for a section, the output for Enrollment Utilization Rate will remain unchanged because the edit would prevent the formula from being executed correctly since we can’t divide by a null.*

  • If the formula can handle a situation where one of its dependencies is empty, and that data is cleared, it will update normally.


*It still executes, but the calculation results in an error. And when there's an error, we don't have anything to save into that formula field.


Section Rules

You can use Formula Fields to build Filters for Section Rules, making it possible – for example – to verify that Sections meet the required Total Hours range or meet a minimum Space Utilization threshold.


Formula Field Using Another Field Formula

  • A formula field cannot use other formulas as part of its calculation.

  • Instead, the user is expected to manually copy and paste the required formula into the relevant place. 


Nested Collection Fields

Overview

  • Support for “Collection” types of nested fields will work to provide context of the current record and children, but cannot traverse to the parent field. 

  • You should use the “record” property to scope the formula to the current record/list entry.

  • In the below diagram/example, a user could make the description a formula and set the formula to: concat(record.name, " grants ", record.credits, " credits.") to produce a description that is a combination of the name and credits, for each outcome. 

Adjacent Records

This can work in the context of adjacent records as well, but we recommend avoiding this use case, as there is an inherent risk that the formula will break if, for example, the desired index does not exist.

Support

  • Use of formula fields in Curriculum Management and Academic Scheduling supports templates, forms, and proposals.

  • In Curriculum Management, the tool additionally supports display in the PDFs for Curriculum, Syllabus, and Catalog.

  • Backend API changes can also trigger formula field updates. 


Curriculum Calculations Guide 

  • You can use various expressions inside the formula, supporting both numbers and true/false values. 

  • For a full list of expressions, please visit Math.js Documentation. 

    • Note not all expressions found in Math.js as supported.

    • We recommend using the Template’s “Preview” function to manually verify the formula is working before saving. 

  • In the below table, assume course.customFields.field1 equals 4, course.credits.creditHours.min equals 2, and course.credits.creditHours.max equals 4.


Operator

Name

Example

Result

(, )

Grouping

(course.customFields.field1 + 2) / 3    

2

+

Add

course.customFields.field1 + 2    

6

-

Subtract

course.customFields.field1 - 2    

2

*

Multiply

course.customFields.field1 * 2    

8


/

Divide

course.customFields.field1 / 2    

2


%

Percentage

course.customFields.field1 %    

0.04

% mod

Modulus

course.customFields.field1 % 3    

1


>

Greater than    

course.customFields.field1 > 4    

false


>=

Greater than or equal    

course.customFields.field1 >= 4    

true


<

Less than    

course.customFields.field1 < 4    

false


<=

Less than or equal

course.customFields.field1 <= 4    

true


==

Equal    

course.customFields.field1 == 4    

true

and

Logical AND    

course.customFields.field1 > 3 and course.customFields.field1 < 5    

true


or

Logical OR    

course.customFields.field1 > 3 or course.customFields.field1 < 5    

true


? :

Conditional expression    

course.customFields.field1 > 3 ? 1 : 0

1


max

Compute the maximum value of a list with values.

max(1, 5, 3)    

5


min

Compute the minimum value of a list with values.

min(1, 5, 3)    

1

sum

Compute the sum of a list with values.

sum(1, 5, 3)    

9

mean

Compute the mean value of a list with values.    

mean(2, 1, 4, 3)    

2.5


map

Perform a function on each element of a list, where "x" is the current element.

map([1, 2, 4], x * 2)    

[2, 4, 8]


Can also take values from objects inside a list, where "x" is the current element.

map([{ capacity: 1 }, { capacity: 2 }, { capacity: 3 }], x.capacity)    

[1, 2, 3]


concat

To display a range of credit values, you can use the "concat" along with "string" operator.    

concat(string(course.credits.creditHours.min * 2), '-', string(course.credits.creditHours.max* 2))    

4-8


getListItem

Get a specific item from a list. List index starts from 1.    

getListItem([2, 4, 8], 2)    

4




Scheduling Calculation Guide 

  • You can use various expressions inside the formula, supporting both numbers and yes/no values.

  • For a full list of expressions, please visit Math.js Documentation.

  • In the below table, assume section.creditHours equals 4.


Operator

Name

Example

Result

(, )

Grouping

(section.creditHours + 2) / 3    

2

+

Add

section.creditHours + 2    

6

-

Subtract

section.creditHours - 2    

2

*

Multiply

section.creditHours * 2    

8


/

Divide

section.creditHours / 2    

2


%

Percentage

section.creditHours %    

0.04

% mod

Modulus

section.creditHours % 3    

1


>

Greater than    

section.creditHours > 4        

false


>=

Greater than or equal    

section.creditHours >= 4    

true


<

Less than    

section.creditHours < 4    

false


<=

Less than or equal

section.creditHours <= 4    

true


==

Equal    

section.creditHours == 4    

true

and

Logical AND    

section.creditHours > 3 and section.creditHours < 5    

true


or

Logical OR    

section.creditHours > 3 or section.creditHours < 5    

true


? :

Conditional expression    

section.creditHours > 3 ? 1 : 0    

1


max

Compute the maximum value of a list with values.

max(1, 5, 3)    

5


min

Compute the minimum value of a list with values.

min(1, 5, 3)    

1

sum

Compute the sum of a list with values.

sum(1, 5, 3)    

9

mean

Compute the mean value of a list with values.    

mean(2, 1, 4, 3)    

2.5


map


Perform a function on each element of a list, where "x" is the current element.

map([1, 2, 4], x * 2)    

[2, 4, 8]


Can also take values from objects inside a list, where "x" is the current element.

map([{ capacity: 1 }, { capacity: 2 }, { capacity: 3 }], x.capacity)    

[1, 2, 3]


getListItem

Get a specific item from a list. List index starts from 1.    

getListItem([2, 4, 8], 2)    

4


Related Articles

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.