How-to-guides
Updated:
August 17, 2023

How to define conditions and calculated fields

TE Curriculum supports definition of calculated fields and usage of conditions in for instance processes, workflows and screens that based on the condition will execute or show the information or not. This guide provides information on how to define the calculated field and conditional expressions.

Calculated fields and workload planning expressions

TE Curriculum supports usage of expressions in different functional areas of the system. For instance in the definition of calculated fields, where the field 'contact hours'  is automatically calculated based on the number of credits. Or in the calculation of hours in workload planning, where the hours for a lecturer is a calculation of number of students, duration of the activity, number of activities, etc.

The configuration of an expression can be done by the admin.
The logical / mathematical expressions supported are:

  • <field/value><operator><field/value>
  • <function()>

Expression structure: <field/value><operator><field/value>

Calculate the value of a new field based on another field and/or a fixed value.
The supported operators are:

  • + (add)
  • - (substract)
  • * (multiply)
  • / (divide)
  • % (remainder)

The field is identified by the Code. In case a <field> occurs in multiple objects, f.i. credits/optimum and capacity/optimum, the convention to specify the correct <field> is <colon>(<object>) <field>, f.i. :(credits) optimum.

Examples are:

  • (:contactHours * 3) + 100
  • :(credits)optimum) / 2
  • :contactHours * :(capacity)optimum
  • :contactHours + :selfStudyHours

Expression structure: <function()>

Calculate the value of a new field using a function that is based on other fields and values.
The supported functions are:

  • join (concatenate fields / values)
  • coalesce
  • round
  • min
  • max

In case fields are used, they are identified by the Code. In case a <field> occurs in multiple objects, f.i. credits/optimum and capacity/optimum, the convention to specify the correct <field> is <colon>(<object>) <field>, f.i. :(credits) optimum.

Examples are:

  • join("City = ", :location) that results in "City = AMS"
  • round(:contactHours)
  • round((:contactHours / 3) + (:students * 0.3))
  • coalesce(:maxStudents, :students, 100), will pick the first 'not empty' value in the defined order. So if maxStudents is empty students is taken.
  • min(:capacity, 50)), will take the lowest of the two values.  If :capacity > 50 then 50 else :capacity
  • max(:capacity-50, 0)), will take the highest of the two values.  If :capacity-50<0 then 0 else :capacity

Conditional rules

The configuration supports definition of conditional rules. These rules can be used to prevent fields from showing, skip workflow steps or process statuses.

On a field definition it will be possible for the administrator to configure the visibility of the field:

  • It will be added to the field configuration, which means that the 'visibility' is global and not specific for a screen
  • It is presumed the system administrator is knowledgable to define the definition and doesn't need complex configuration options to do so.
  • Fields supported are 'additional fields' and 'descriptions'.

The field configuration should allow the system administrator to define the rule to 'show' the field, based on a field (on the object, and/or on the same page).
The rendering for these cases will be different. In case the object is on the page, it might be that the fields will appear on the screen after selection of a specific value. On toggle in screen, the existing data will be deleted, in case a field is made invisible.

The configuration of a conditional rule can be done by the admin.
The rules supported are:

  • <field> in (<value>, <value>)
  • <field><operator><field or value>
  • <logical operator>

Rule configuration: <field> in (<value>, <value>)

Conditional execute / show information based on the value of another field and/or a fixed value.

The field is identified by the Code. In case a <field> occurs in multiple objects, f.i. credits/optimum and capacity/optimum, the convention to specify the correct <field> is <colon>(<object>) <field>, f.i. :(credits) optimum.

Examples are:

  • :(module)typeId in (STANDARD, MOOC)
  • :free_choice in (true)
  • :country in ('EN', 'NL', 'DE', 'SW')
  • :country not in ('UK', 'ES')

Rule configuration: <field><operator><field or value>

Only show the field in case the expression with referenced field or value is met.

The supported functions are:

  • >
  • >=
  • <
  • <=
  • !=

In case fields are used, they are identified by the Code. In case a <field> occurs in multiple objects, f.i. credits/optimum and capacity/optimum, the convention to specify the correct <field> is <colon>(<object>) <field>, f.i. :(credits) optimum.

Examples are:

  • :nr_of_students < 100
  • :max_credits < 6
  • :nr_of_students < :max_students
  • :(credits) optimum <= :(credits) max

Rule configuration: <logical operator>

Only show the field in case the expression is met.

The supported functions are:

  • && or AND
  • || or OR

In case fields are used, they are identified by the Code. In case a <field> occurs in multiple objects, f.i. credits/optimum and capacity/optimum, the convention to specify the correct <field> is <colon>(<object>) <field>, f.i. :(credits) optimum.

Examples are:

  • :type = 'Minor' and :location = 'AMS'
    It is advised to enclose the operands with single quote to allow values like 'AMS-A'
  • :type = 'Minor' && :location = 'AMS'
  • :location in ('AMS','RTD') or :country='UK'
  • :location in ('AMS','RTD') || :country='UK'

Testing configured conditions and calculated fields

Configured expressions for a calculated fields and conditions can be tested via the test tool.

To test just click on the V-mark next to a Formula or Condition definition

Click on the v-mark to open the test tool for the configuration rule or expression.

Select an educational object (just start typing the name of a study, module group or module) and click on Evaluate to check the result.

Expressions can be tested via the test tool, using actual data

Customer unique training

This class is available to receive tailor made for your database set-up. Just fill out the form below and our product expert will get in touch with you to set-up your bespoke class.
I want a bespoke class